[FFmpeg-devel] RFC: Preserving original demux timestamps in AVPackets

Devin Heitmueller devin.heitmueller at ltnglobal.com
Fri Mar 3 23:53:27 EET 2023


Hello all,

I am working on some SCTE-35 stuff, which embeds PTS timestamps deep
within the section payload.  In order to pass through packets to an
MPEG-TS output, I need the original PTS value that was used when the
packet was received to calculate the correct offsets.

The way a typical ffmpeg-based application works is to read in the
packets, and then recalculate the pts/dts fields prior to output using
the existing fields.  This results in loss of the original values.

I need to stash the original PTS value somewhere within the AVPacket
so I can use it for subsequent calculations on the output side.  In my
private tree I have done this through a new AVPacket side data type
called "AV_PKT_DATA_ORIG_PTS", but it wasn't clear to me if such a
patch would be accepted upstream.  Alternatively, I can set a metadata
field on the packet using av_packet_pack_dictionary() and use the
existing AV_PKT_DATA_STRINGS_METADATA type.  However that would
require it to be converted to a string and back, and seems less than
ideal.

Does anyone have any other suggestions on a way the original received
PTS value can be stashed within an AVPacket in a manner that would be
accepted upstream?

Thanks,

Devin

-- 
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmueller at ltnglobal.com


More information about the ffmpeg-devel mailing list