Skip to content

BUG: Audio stream not captured in process_video #1923

@Ashp116

Description

@Ashp116

Search before asking

  • I have searched the Supervision issues and found no similar bug report.

Bug

The process_video function currently does not record or preserve the audio stream from the source_path. While it correctly processes and renders the video frames, it completely disregards the audio component, resulting in an output video that has no sound.

Environment

No response

Minimal Reproducible Example

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

model = YOLO('yolo11n.pt')
trace_annotator = sv.TraceAnnotator(thickness=4, color=sv.Color.BLUE)

vid_path = VideoAssets.BASKETBALL.value #"original.mp4"
download_assets(VideoAssets.BASKETBALL.value)

video_info = sv.VideoInfo.from_video_path(video_path=vid_path)
frames_generator = sv.get_video_frames_generator(source_path=vid_path)
tracker = sv.ByteTrack()

def callback(frame, i):
    result = model(frame, verbose=False)[0]
    detections = sv.Detections.from_ultralytics(result)
    detections = tracker.update_with_detections(detections)
    
    annotated_frame = trace_annotator.annotate(
        scene=frame.copy(),
        detections=detections)
    
    return annotated_frame

sv.process_video(
    source_path=vid_path,
    target_path='output-annotator-1.mp4',
    callback=callback,
    show_progress=True
)

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions