diff --git a/handle_imported_video.py b/handle_imported_video.py index 4924f29..498454c 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -7,6 +7,8 @@ import datetime import shutil import json import getopt +from ffmpeg_progress_yield import FfmpegProgress +from tqdm import tqdm if sys.platform == "linux" or sys.platform == "linux2": # linux @@ -113,21 +115,53 @@ if os.path.exists(_FULL_PATH): f.close() print(_FULL_PATH) - if _FLIP: - if ops == "win": - myCmd = 'ffmpeg -display_rotation 180 -f concat -i video.txt -vcodec copy -acodec copy ' + export_name - else: - myCmd = '/opt/ffmpeg/ffmpeg -display_rotation 180 -f concat -i video.txt -vcodec copy -acodec copy ' + export_name - else: - if ops == "win": - myCmd = 'ffmpeg -f concat -i video.txt -vcodec copy -acodec copy ' + export_name - else: - myCmd = '/opt/ffmpeg/ffmpeg -f concat -i video.txt -vcodec copy -acodec copy ' + export_name + # if _FLIP: + # if ops == "win": + # myCmd = 'ffmpeg -display_rotation 180 -f concat -i video.txt -vcodec copy -acodec copy ' + export_name + # else: + # myCmd = '/opt/ffmpeg/ffmpeg -display_rotation 180 -f concat -i video.txt -vcodec copy -acodec copy ' + export_name + # else: + # if ops == "win": + # myCmd = 'ffmpeg -f concat -i video.txt -vcodec copy -acodec copy ' + export_name + # else: + # myCmd = '/opt/ffmpeg/ffmpeg -f concat -i video.txt -vcodec copy -acodec copy ' + export_name + + + + + + print(myCmd) print(os.getcwd()) - status, output = subprocess.getstatusoutput(myCmd) - #print(output) - print(status) + #status, output = subprocess.getstatusoutput(myCmd) + + if _FLIP: + if ops == "win": + myCmd = [ + "ffmpeg", "-display_rotation", "180", "-f", "concat", "-i", "video.txt ","-vcodec", "copy", "-acodec", "copy", export_name ,"-f", "null", "/dev/null", + ] + else: + myCmd = [ + "/opt/ffmpeg/ffmpeg", "-display_rotation", "180", "-f", "concat", "-i", "video.txt ","-vcodec", "copy", "-acodec", "copy", export_name ,"-f", "null", "/dev/null", + ] + else: + if ops == "win": + myCmd = [ + "ffmpeg", "-f", "concat", "-i", "video.txt ","-vcodec", "copy", "-acodec", "copy", export_name ,"-f", "null", "/dev/null", + ] + else: + myCmd = [ + "/opt/ffmpeg/ffmpeg", "-f", "concat", "-i", "video.txt ","-vcodec", "copy", "-acodec", "copy", export_name ,"-f", "null", "/dev/null", + ] + + ff = FfmpegProgress(myCmd) + with tqdm(total=100, position=1, desc="Convert") as pbar: + for progress in ff.run_command_with_progress(): + pbar.update(progress - pbar.n) + + # get the output + print(ff.stderr) + status = 0 if status == 0: print("Moving...") for p in parts: