Use libvpx-vp9 for main decode too

An extra pass was added to the ffmpeg_frame_generation code to properly
detect and handle alpha when loading vp9 videos. This early commit
allowed for correct detection, but then failed to apply the decoder to
the main pass, so no alpha was output. This has been fixed.
This commit is contained in:
Austin Mroz
2025-07-26 15:38:20 -05:00
parent be11f43838
commit 285568f530
+7 -7
View File
@@ -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: