Skip to content

Feature Request: Support adding Frame side data. #1153

@anthornt

Description

@anthornt

Overview

I would like to be able to add side data to Frames. Specifically closed caption data (Type.A53_CC).

Existing FFmpeg API

av_frame_new_side_data()

Expected PyAV API

I would like to add side data to selected frames, for example by adding a new API Frame.side_data.add().

Example (modified examples/numpy/generate_video.py):

stream = container.add_stream("libx264", rate=fps)
...
for frame_i in range(total_frames):
    ...
    frame = av.VideoFrame.from_ndarray(img, format="rgb24")

    if (frame_i % fps) == 0:
        # Add closed caption
        data = bytearray()
        ...
        frame.side_data.add(data, Type.A53_CC)

Investigation

I tried the attached patches to generate video with 608 style closed captions by modifying the generate video example.

I didn't manage to get the Frame.side_data updated correctly.

20230817.0.patch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions