Opened 10 years ago

Last modified 9 years ago

#3148 new defect

SubRip subtitles to TX3G problems when the millisecond in the presentation timestamp are not a multiple of 10

Reported by: pdamont Owned by:
Priority: normal Component: undetermined
Version: 2.1 Keywords: subrip mov_text mov
Cc: pdamont Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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.

Attachments (4)

not-rounded_3_text.ttxt (1.6 KB ) - added by pdamont 10 years ago.
not-rounded.srt (34.3 KB ) - added by pdamont 10 years ago.
rounded.srt (34.2 KB ) - added by pdamont 10 years ago.
rounded_3_text.ttxt (1.6 KB ) - added by pdamont 10 years ago.

Download all attachments as: .zip

Change History (9)

by pdamont, 10 years ago

Attachment: not-rounded_3_text.ttxt added

by pdamont, 10 years ago

Attachment: not-rounded.srt added

by pdamont, 10 years ago

Attachment: rounded.srt added

by pdamont, 10 years ago

Attachment: rounded_3_text.ttxt added

comment:1 by pdamont, 10 years ago

Summary: SubRip subtitles to mov text problems when the millisecond in the presentation timestamp are not a multiple of 10SubRip subtitles to TX3G problems when the millisecond in the presentation timestamp are not a multiple of 10

comment:2 by pdamont, 10 years ago

Cc: pdamont added

comment:3 by pdamont, 10 years ago

Component: avcodecundetermined
Keywords: mov_text tx3g quicktime added

comment:4 by Carl Eugen Hoyos, 10 years ago

Keywords: mov added; subtitles tx3g quicktime removed

Is the problem reproducible with current FFmpeg git head?
Please provide the failing command line together with the complete, uncut console output.

comment:5 by pdamont, 9 years ago

Problem seems solved (subtitles appear) with version 2.6.0, however I get a lot of warnings like this one:

[mp4 @ 0x7fe1e2034200] Application provided duration: -3 / timestamp: 2161710 is out of range for mov/mp4 format
[mp4 @ 0x7fe1e2034200] pts has no value

Command line was:

ffmpeg  -i input.mkv  -i sub.srt -c:v copy -c:a copy -c:s mov_text output.mp4

I have to add -fix_sub_duration to remove them:

ffmpeg  -i input.mkv  -fix_sub_duration -i sub.srt -c:v copy -c:a copy -c:s mov_text output.mp4
Last edited 9 years ago by pdamont (previous) (diff)
Note: See TracTickets for help on using tickets.