4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 10:34:29 +08:00

Fix issue when extracting all frames from a video. (#2413)

* Remove superfluous num_frames

* process_data video: Always use -vsync vfr, even when extracting all images.
This commit is contained in:
Sebastiaan 2023-09-09 01:00:10 +02:00 committed by GitHub
parent 06e59ed1ec
commit 77ac7d0cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,7 +167,6 @@ def convert_video_to_images(
start_y = crop_factor[0]
crop_cmd = f"crop=w=iw*{width}:h=ih*{height}:x=iw*{start_x}:y=ih*{start_y},"
num_frames = get_num_frames_in_video(video_path)
spacing = num_frames // num_frames_target
downscale_chains = [f"[t{i}]scale=iw/{2**i}:ih/{2**i}[out{i}]" for i in range(num_downscales + 1)]
@ -184,9 +183,10 @@ def convert_video_to_images(
+ ";".join(downscale_chains)
)
ffmpeg_cmd += " -vsync vfr"
if spacing > 1:
CONSOLE.print("Number of frames to extract:", math.ceil(num_frames / spacing))
ffmpeg_cmd += " -vsync vfr"
select_cmd = f"thumbnail={spacing},setpts=N/TB,"
else:
CONSOLE.print("[bold red]Can't satisfy requested number of frames. Extracting all frames.")