diff --git a/handle_imported_video.py b/handle_imported_video.py index 2aaa7e4..a4d6984 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -19,7 +19,7 @@ elif sys.platform == "darwin": elif sys.platform == "win32": ops = "win" try: - opts, args = getopt.getopt(sys.argv[1:], "a:r:fp:d:s:", ["command=", "help", "output=", "backup"]) + opts, args = getopt.getopt(sys.argv[1:], "ta:r:fp:d:s:", ["command=", "help", "output=", "backup"]) except getopt.GetoptError as err: # print help information and exit: print(str(err)) # will print something like "option -a not recognized" @@ -30,6 +30,7 @@ output = None _DEV = "gopro9_1" _SEQUENCES = [] _FLIP = False +_TEST = False if ops == "win": _SOURCE_DIR = "p:\\imported\\" else: @@ -47,6 +48,8 @@ for o, a in opts: _SOURCE_DIR = a elif o in ("-a", "--action"): _ACTION = a + elif o in ("-t", "--test"): + _TEST = True elif o in ("-s", "--sequence"): a = a.split(",") for s in a: @@ -117,11 +120,16 @@ if _ACTION == "join": f.write("# Files to join\n") f.close() f = open("video.txt", "a") + final_size = 0 for p in parts: f.write(f"file '{p}'\n") - + file_stats = os.stat(p) + final_size += file_stats.st_size / (1024 * 1024) f.close() + print(final_size) print(_FULL_PATH) + if _TEST: + input(" ???? ") # if _FLIP: # if ops == "win": # myCmd = 'ffmpeg -display_rotation 180 -f concat -i video.txt -vcodec copy -acodec copy ' + export_name @@ -163,9 +171,11 @@ if _ACTION == "join": print(myCmd) print(f"Joining {len(parts)} files...") 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) + # with tqdm(total=100, position=1, desc="Convert") as pbar: + # for progress in ff.run_command_with_progress(): + # pbar.update(progress - pbar.n) + + file_stats = os.stat(file_name) # get the output print(ff.stderr)