[FFmpeg-devel] [RFC] Subtitles: seek, rectime, residual, new API

Nicolas George nicolas.george at normalesup.org
Wed Aug 1 11:05:02 CEST 2012


Le quartidi 14 thermidor, an CCXX, Clément Bœsch a écrit :
> I'm quite confused about that stuff. sync_opts is badly named, and the
> usage are weird, for example "ost->sync_opts = frame->pts +
> frame->nb_samples;" for audio, I just don't get it.

AFAICS, sync_opts is expressed in encoder time base, and I guess audio
encoders must always use 1/sample_rate as time base.

> Well, there is actually another solution: let the muxer deal with the
> timestamp all the time. This way, it will also works with -c:s copy...

Sorry, that was the one I wanted to say "yes, yes, yes" to. Currently,
packets come out of the demuxer like that:

pts_time=1.000000
duration=N/A
data=
00000000: 4469 616c 6f67 7565 3a20 302c 303a 3030  Dialogue: 0,0:00
00000010: 3a30 312e 3030 2c30 3a30 303a 3033 2e30  :01.00,0:00:03.0
00000020: 302c 456e 676c 6973 682c 2c30 2c30 2c30  0,English,,0,0,0
00000030: 2c2c 4865 6c6c 6f20 576f 726c 6421 0d0a  ,,Hello World!..
00000040: 4469 616c 6f67 7565 3a20 302c 303a 3030  Dialogue: 0,0:00
00000050: 3a30 312e 3030 2c30 3a30 303a 3033 2e35  :01.00,0:00:03.5
00000060: 302c 4672 656e 6368 2c2c 302c 302c 302c  0,French,,0,0,0,
00000070: 2c42 6f6e 6a6f 7572 204d 6f6e 6465 210d  ,Bonjour Monde!.
00000080: 0a                                       .

pts_time=1.000000
duration_time=2.000000
data=
00000000: 302c 302c 456e 676c 6973 682c 2c30 2c30  0,0,English,,0,0
00000010: 2c30 2c2c 4865 6c6c 6f20 576f 726c 6421  ,0,,Hello World!
pts_time=1.000000
duration_time=2.500000
00000000: 312c 302c 4672 656e 6368 2c2c 302c 302c  1,0,French,,0,0,
00000010: 302c 2c42 6f6e 6a6f 7572 204d 6f6e 6465  0,,Bonjour Monde
00000020: 21                                       !

> > Note that there is a problem with Matroska, which merges the ASS packets
> > that start at the same time, and thus make it impossible to have a proper
> > duration on the packet.
> Can you be more specific about that?

That is visible on the example above: the two lines of subtitles start at
pts_time=1, the Matroska demuxer merges them into a single packet. Since
they do not have the same duration, the packet can not have any meaningful
duration field.

Note that the ASS demuxer does not do that.

The problem seems related to the fact that the packets also have the same
DTS, which lavf does not like when muxing. But having the same DTS is IMHO
normal for subtitles codecs that can handle overlapping.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120801/7aab074b/attachment.asc>


More information about the ffmpeg-devel mailing list