From 832517499523ef98d0c95783aa2d9045ee082c3f Mon Sep 17 00:00:00 2001 From: j Date: Wed, 6 Sep 2017 14:48:37 +0200 Subject: [PATCH] prefix path --- edit.py | 2 +- ffmpeg.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/edit.py b/edit.py index f659a6d..0ea433b 100755 --- a/edit.py +++ b/edit.py @@ -117,7 +117,7 @@ if __name__ == '__main__': info = get_info(api, clip['streams'][i]) videos.append({ 'oshash': clip['streams'][i], - 'path': info['path'], + 'path': os.path.join(prefix, info['path']), 'resolution': info['resolution'], 'in': stream_in, 'out': stream_out, diff --git a/ffmpeg.py b/ffmpeg.py index 31dae70..faf45f9 100755 --- a/ffmpeg.py +++ b/ffmpeg.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +import math import json import os import subprocess @@ -71,13 +72,15 @@ for clip in edit: '-ac', '2', '-b:a', '192k', ] + clip_duration = math.ceil((clip['out'] - clip['in']) / (1/25)) * 1/25 + cmd = [ 'ffmpeg', '-nostats', '-loglevel', 'error', '-ss', str(clip['in']), '-i', clip['path'] ] + options + [ - '-t', str(clip['out'] - clip['in']), + '-t', str(clip_duration), out ] run(cmd)