Skip to content

Conversation

@cdeil
Copy link

@cdeil cdeil commented Nov 7, 2025

This PR fixes the process_video function.

There used to be an if-else but somewhere the if fell off the truck resulting in a for-else that doesn't make sense.

This PR also fixes the following case of passing a max_frames that is larger than the frames in the video.
Before this PR is would give Exception: Requested frames are outbound and with it it will simply process the whole video, i.e. treat "max" frames as a max but OK if there are less frames (I think what most users expect/want).

import supervision as sv
from supervision.assets import VideoAssets, download_assets

download_assets(VideoAssets.PEOPLE_WALKING)

video_info = sv.VideoInfo.from_video_path("people-walking.mp4")

sv.process_video(
    source_path="people-walking.mp4",
    target_path="people-talking.mp4",
    callback=lambda frame, _: frame,
    max_frames=1000,
)

I also added a test case (the agent wrote it). Not sure if you want such tests or if/how you want to treat temp dirs and example asset video files in this repo. Let me know whatever you prefer and I can remove that or adjust.

@cdeil cdeil requested a review from SkalskiP as a code owner November 7, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant