Merge pull request #1829 from roboflow/fix/process_video

fix: `UnboundLocalError` in `process_video`
This commit is contained in:
Piotr Skalski 2025-04-25 14:55:29 +02:00 committed by GitHub
commit 21fc9afbdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 7 deletions

View File

@ -234,13 +234,11 @@ def process_video(
source_path=source_path, end=max_frames
)
with VideoSink(target_path=target_path, video_info=source_video_info) as sink:
if show_progress:
# Calculate total_frames only when needed for tqdm
total_frames = (
min(source_video_info.total_frames, max_frames)
if max_frames is not None
else source_video_info.total_frames
)
total_frames = (
min(source_video_info.total_frames, max_frames)
if max_frames is not None
else source_video_info.total_frames
)
for index, frame in enumerate(
tqdm(
video_frames_generator,