Support writing arbitrary key/value pairs to container metadata #1601
Closed
Michael-Equi
started this conversation in
2. Feature Ideas
Replies: 3 comments
|
In addition to adding metadata to the container. Let's also be able to add it to the streams.
|
0 replies
This comment was marked as disruptive content.
This comment was marked as disruptive content.
|
(newer) PyAV already supports arbitrary container metadata. For MP4, FFmpeg requires the use_metadata_tags muxer flag for nonstandard keys: with av.open(
output, mode="w", format="mp4", options={"movflags": "+use_metadata_tags"},
) as container:
container.metadata["key"] = "value"Make sure metadata is set before encoding or muxing begins, since the metadata is written with the container header. Streams also expose a metadata dictionary: stream = container.add_stream("libx264", rate=30)
stream.metadata["source"] = "ACMEcam"Arbitrary stream metadata works with formats such as Matroska. MP4 only preserves certain stream-level metadata fields, even when use_metadata_tags is enabled, which is a limitation of FFmpeg’s MP4 muxer rather than PyAV. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Desired Behavior
Currently only the title is allowed to be written to a containers metadata. The behavior is tested in the following unit test:
PyAV/tests/test_encode.py
Line 74 in 86f66ac
I have confirmed ffmpeg does support this by using the following CLI command given the path to a libx264 encoded video.
Example API
Allow any arbitrary key/value pair to be written to the metadata in the same way title can be written to the metadata.
All reactions