PyAV
PyAV copied to clipboard
Added __set__ for duration property of Packet
Overview
Currently, PyAV does not provide a straightforward way to modify the duration of packets in media files. This feature request proposes to add support for modifying duration of packets in PyAV.
Desired Behavior
PyAV should provide methods to modify duration of packets. Specifically:
A method to modify duration of packets, which can be useful for adjusting the playback speed of a video or audio file. A method to modify packet duration can be useful for adjusting timing or frame rate in a media file.
Example API
Here is an example API that demonstrates how PyAV could support modifying duration of packets:
for packet in input.demux(input_stream):
packet.duration = int(packet.duration * packet.time_base / output_stream.time_base)
packet.time_base = output_stream.time_base
packet.dts = last_dts + packet.duration
packet.pts = last_pts + packet.duration
last_pts, last_dts = packet.pts, packet.dts
packet.stream = output_stream
output_container.mux(packet)
Additional context
Adding support for modifying duration in PyAV would make it easier for users to adjust the timing, playback speed, and other aspects of media files using Python.
I would like for this to be tested before merging.
Do you have a recommended way you'd like to test this? I didn't see any existing tests that would cover this well
Too old.
I still need this so if I rebase then can it be merged? Do you have a recommended way to test this?
I'm carrying this patch and would like to be able to upgrade to 12.0 so can this be merged? Do you have a recommended way to test this?