[FFmpeg-trac] #3148(avcodec:new): SubRip subtitles to mov text problems when the millisecond in the presentation timestamp are not a multiple of 10

FFmpeg trac at avcodec.org
Sun Nov 17 16:33:14 CET 2013

#3148: SubRip subtitles to mov text problems when the millisecond in the
presentation timestamp are not a multiple of 10
             Reporter:  pdamont      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avcodec      |                  Version:  2.1
             Keywords:  subrip       |               Blocked By:
  subtitles                          |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
 Summary of the bug:
 I have the exact 2 same subtitles in sub rib (.srt) format.

 * One (not-rounded.srt) has timestamp in the form:
 00:00:00,991 --> 00:00:03,227

 * The other one (rounded.srt) is the same but with rounded timestamp (no
 millisecond, only multiples of 10 ms):
 00:00:00,990 --> 00:00:03,230

 When I encode a MP4 movie including one or the other subtitles, in
 QuickTime or iPad or iPhone, only the resulting movie with rounded
 subtitles shows every subtitles. When it's not rounded, only the first
 subtitle is displayed.

 Here is the command line:
 ffmpeg -i source.mp4 -i rounded.srt  -c:v copy -c:a copy -c:s mov_text
 -metadata:s language=eng rounded.mp4

 I extracted the TX3G subtitles using MP4Box:
 MP4Box -ttxt 3 rounded.mp4
 MP4Box -ttxt 3 not-rounded.mp4

 '''and I can see surprising results: when it's not rounded, the timestamps
 are unordered, and blank subtitles are in fact preventing the subtitles to
 be displayed, for instance:'''

 * not-rounded_3_text.ttxt:
 <TextSample sampleTime="00:00:03.231" xml:space="preserve"></TextSample>
 <TextSample sampleTime="00:00:03.228" xml:space="preserve">that she
 absolutely loved,</TextSample>

 * rounded_3_text.ttxt:
 <TextSample sampleTime="00:00:03.230" xml:space="preserve"></TextSample>
 <TextSample sampleTime="00:00:03.230" xml:space="preserve">that she
 absolutely loved,</TextSample>

 So right now to soft encode subtitles I first encode my srt to ass with
 one ffmpeg command (subrip -> ass conversion), and then use the ass
 subtitles instead (ass -> mov_text mapping). I do that because I have
 noticed the srt->ass conversion rounds timestamp. But it's a shame,
 because I should be able to use directly (subrip -> mov_text) even with
 srt file which have precise timestamps up to the millisecond.

 Attached are the ttxt output from mp4box and the srt files.

 Since the ttxt output is wrong (unordered and blank text displayed right
 after actual subtitles), I believe there is a bug here.

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/3148>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list