[FFmpeg-devel] mpegts_write_header(), the buffering and thus reordering of audio samples.

Will Korbe wkorbe at gmail.com
Tue Nov 1 02:24:07 CET 2011


Hello,

I hopefully have a minor question about the
libavformat/mpegtssec.c:mpegts_write_header() implementation. My hours
of online searching and specification reading for the answer has been
unsuccessful.

I see there is an efficiency built in to bundle multiple audio samples
into one PES packet and was wondering if someone could point out a
paragraph from the MPEG2 specification which indicates the reordering
of TS Packets this causes is okay? I have a video with many 41 byte
audio samples at the start, and this seems to push the first audio
samples 5 seconds into the output. At this point, the PTS and DTS for
the audio samples are beyond the last PCR value by 5 seconds. The
video plays fine in QuickTime, the audio and video are precisely in
sync, so I assume QuickTime has logic to buffer the video frames until
seeming the first audio sample to account for this, but I wonder if
most MPEG2TS players handle this the same way. If this is spelled out
in the specification, I would sure feel more comfortable with it.

Any information would be useful.

Thank you,
Will


More information about the ffmpeg-devel mailing list