PyAV
PyAV copied to clipboard
Support writing arbitrary key/value pairs to container metadata
Desired Behavior
Currently only the title is allowed to be written to a containers metadata. The behavior is tested in the following unit test: https://github.com/PyAV-Org/PyAV/blob/86f66ac1c6682c5c07aeb8df4e070b0fe3723fb7/tests/test_encode.py#L74
I have confirmed ffmpeg does support this by using the following CLI command given the path to a libx264 encoded video.
subprocess.run(
[
"ffmpeg",
"-y", # Overwrite output files without asking
"-i",
input,
"-c",
"copy",
"-copyts", # Copy timestamps from input to output
"-metadata",
f"key={value}",
"-movflags",
"+use_metadata_tags",
output,
],
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.