[FFmpeg-devel] Supporting container formats with PTS gaps (Ogg)

Peter Ross pross
Mon Feb 2 14:39:18 CET 2009


The design of Ogg container format challenges the way FFmpeg (and most other
media tools) do business. Namely:

1. A PTS value is typically associated with a group of video or audio packets.
2. The PTS value applies to the last packet in the group.
3. Encoding of the PTS value is defined on a per-codec basis.

I am struggling with how to support #1 properly, and am looking for 'ideas'.
At present the Ogg demuxer reports the PTS value for the packets that
actually have a PTS, and and AV_NOPTS_VALUE for other packets.

This is adequate for simple playback, but when copying an Ogg file to
another format, things break. For example, the ffmpeg program tries to
calculate the DTS value from the previous PTS (see output_packet() ffmpeg.c
 ~1396). There is some other functional cruft in libavformat that attempts
to calculate PTS from DTS (compute_pkt_fields2() in libavformat/utils.c ~2548).

One solution would be to make the Ogg demuxer calculate the missing PTS
values on by inspecting the codec payload headers and detrerming the
bit/sample rate. This seems to be what the 'liboggz' folks have done.
Another would be to set a flag in demuxer context that advises against
auto calulation of DTS. Neither is very elegant...

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090203/7623dd88/attachment.pgp>

More information about the ffmpeg-devel mailing list