From dfe285ea5ffed6bcb0a3ecb8ef5a33637d9cd340 Mon Sep 17 00:00:00 2001 From: Zen <46526140+master-of-zen@users.noreply.github.com> Date: Thu, 9 Jan 2020 17:49:28 +0200 Subject: [PATCH] arg_parsing to different function --- main.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8786e1e..2da5c59 100644 --- a/main.py +++ b/main.py @@ -19,6 +19,20 @@ except: print('ERROR: No PyScenedetect installed, try: sudo pip install scenedetect') +def arg_parsing(): + """ + Command line parser + """ + + parser = argparse.ArgumentParser() + parser.add_argument('--encoding_params', type=str, + default=' -an -c:v libaom-av1 -strict -2 -row-mt 1 -tiles 2x2 -cpu-used 8 -crf 60 ', + help='FFmpeg settings') + parser.add_argument('--input_file', '-i', type=str, default='bruh.mp4', help='input video file') + parser.add_argument('--num_worker', '-t', type=int, default=8, help='number of encode running at a time') + return parser.parse_args() + + def get_cpu_count(): return os.cpu_count() @@ -101,7 +115,10 @@ if __name__ == '__main__': parser.add_argument('--encoding_params', type=str, default=' -an -c:v libaom-av1 -strict -2 -row-mt 1 -tiles 2x2 -cpu-used 8 -crf 60 ', help='FFmpeg settings') parser.add_argument('--input_file', '-i', type=str, default='bruh.mp4', help='input video file') parser.add_argument('--num_worker', '-t', type=int, default=8, help='number of encode running at a time') - args = parser.parse_args() + + args = arg_parsing() # Main thread - main(args.input_file, args.encoding_params, args.num_worker) \ No newline at end of file + start = time.time() + main(args.input_file, args.encoding_params, args.num_worker) + print(f'Encoding completed in {round(time.time()-start)}ces')