diff --git a/videohelpersuite/load_video_nodes.py b/videohelpersuite/load_video_nodes.py index f94c608..03f4f1a 100644 --- a/videohelpersuite/load_video_nodes.py +++ b/videohelpersuite/load_video_nodes.py @@ -170,7 +170,8 @@ def cv_frame_generator(video, force_rate, frame_load_cap, skip_first_frames, def ffmpeg_frame_generator(video, force_rate, frame_load_cap, start_time, custom_width, custom_height, downscale_ratio=8, meta_batch=None, unique_id=None): - args_dummy = [ffmpeg_path, "-i", video, '-c', 'copy', '-frames:v', '1', "-f", "null", "-"] + args_input = ["-i", video] + args_dummy = [ffmpeg_path] + args_input +['-c', 'copy', '-frames:v', '1', "-f", "null", "-"] size_base = None fps_base = None try: @@ -181,7 +182,8 @@ def ffmpeg_frame_generator(video, force_rate, frame_load_cap, start_time, + e.stderr.decode(*ENCODE_ARGS)) lines = dummy_res.stderr.decode(*ENCODE_ARGS) if "Video: vp9 " in lines: - args_dummy = args_dummy[:1] + ["-c:v", "libvpx-vp9"] + args_dummy[1:] + args_input = ["-c:v", "libvpx-vp9"] + args_input + args_dummy = [ffmpeg_path] + args_input +['-c', 'copy', '-frames:v', '1', "-f", "null", "-"] try: dummy_res = subprocess.run(args_dummy, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, check=True) @@ -214,15 +216,13 @@ def ffmpeg_frame_generator(video, force_rate, frame_load_cap, start_time, if start_time > 0: if start_time > 4: post_seek = ['-ss', '4'] - pre_seek = ['-ss', str(start_time - 4)] + args_input = ['-ss', str(start_time - 4)] + args_input else: post_seek = ['-ss', str(start_time)] - pre_seek = [] else: - pre_seek = [] post_seek = [] - args_all_frames = [ffmpeg_path, "-v", "error", "-an"] + pre_seek + \ - ["-i", video, "-pix_fmt", "rgba64le"] + post_seek + args_all_frames = [ffmpeg_path, "-v", "error", "-an"] + \ + args_input + ["-pix_fmt", "rgba64le"] + post_seek vfilters = [] if force_rate != 0: