Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8101 closed defect (fixed)

Subtitles : Timestamps of each paragraph are incorrect

Reported by: fcaspar77 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello,

I'm trying to get the subtitles from an MPEG-TS file with subtitles in dvb_teletext.

I tried it with several recent versions and here are the results :

With FFMPEG v4.1.4 :

% ffmpeg -y -txt_format text -txt_page 889 -i /tmp/action.ts -c:s webvtt -map i:0x4c6 /tmp/out.vtt
ffmpeg version 4.1.4 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --enable-libass --enable-libfdk_aac --enable-libfreetype --enable-libfontconfig --enable-libfribidi --enable-libmp3lame --enable-librtmp --enable-libsrt --enable-libvpx --enable-libx265 --enable-libx264 --enable-libxml2 --enable-libzvbi --enable-nonfree --enable-openssl --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[h264 @ 0x564be55adf40] SPS unavailable in decode_picture_timing
[h264 @ 0x564be55adf40] non-existing PPS 0 referenced
[h264 @ 0x564be55adf40] SPS unavailable in decode_picture_timing
[h264 @ 0x564be55adf40] non-existing PPS 0 referenced
[h264 @ 0x564be55adf40] decode_slice_header error
[h264 @ 0x564be55adf40] no frame!
....
[h264 @ 0x564be55adf40] SPS unavailable in decode_picture_timing
[h264 @ 0x564be55adf40] non-existing PPS 0 referenced
[h264 @ 0x564be55adf40] SPS unavailable in decode_picture_timing
[h264 @ 0x564be55adf40] non-existing PPS 0 referenced
[h264 @ 0x564be55adf40] decode_slice_header error
[h264 @ 0x564be55adf40] no frame!
    Last message repeated 3 times
[mpegts @ 0x564be55a8fc0] PES packet size mismatch
    Last message repeated 2 times
Input #0, mpegts, from '/tmp/action.ts':
  Duration: 00:00:51.38, start: 94206.543944, bitrate: 15696 kb/s
  Program 78 
    Metadata:
      service_name    : Action HD
      service_provider: A provider
    Stream #0:0[0x336]: Video: h264 ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x39a](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
    Stream #0:2[0x462](fra): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x4c6](fra,fra): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x52a](qaa): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s
Output #0, webvtt, to '/tmp/out.vtt':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0(fra,fra): Subtitle: webvtt
    Metadata:
      encoder         : Lavc58.35.100 webvtt
Stream mapping:
  Stream #0:3 -> #0:0 (dvb_teletext (libzvbi_teletextdec) -> webvtt (native))
Press [q] to stop, [?] for help
size=       1kB time=00:00:45.16 bitrate=   0.2kbits/s speed=1.12e+03x    
video:0kB audio:0kB subtitle:1kB other streams:0kB global headers:0kB muxing overhead: 84.971100%

And the generated VTT file is as followed (I have the same behaviour with SRT) :

WEBVTT

00:00.280 --> 1193:02:47.575
ou sérieusement dans la merde.

00:04.000 --> 1193:02:51.295
C'est entièrement ma faute.
Le crâne m'a glissé des mains.

00:08.760 --> 1193:02:56.055
Ne te culpabilise pas.
On fait tous des erreurs.

00:13.200 --> 1193:03:00.495
- Celle-là est grave.
- C'est-à-dire ?

00:16.760 --> 1193:03:04.055
C'était la Confrérie Singh...

00:19.040 --> 1193:03:06.335
J'ai vu la toile
d'araignée tatouée.

00:21.200 --> 1193:03:08.495
Tu as laissé un crâne de Tuganda
à la Confrérie Singh !

00:26.880 --> 1193:03:14.175
Ce qu'ils tentaient d'obtenir
depuis 400 ans !

00:33.040 --> 1193:03:20.335
Ils n'ont pas les trois.

00:35.680 --> 1193:03:22.975
On ignore combien ils en ont.

00:38.600 --> 1193:03:25.895
Sais-tu ce qui arrivera

00:40.480 --> 1193:03:27.775
si la Confrérie détient ces crânes ?

00:43.400 --> 1193:03:30.695
Elle sera invincible.

00:45.160 --> 1193:03:32.455
Interviens.
Toi seul le peux.

As you can see, the start time and end time of each paragraph do not correspond.
It looks like that the end time is incorrect but because it is a capture of an MPEG-TS stream, it is maybe the start time which is incorrect.

With ffmpeg 4.2, I have the following :

% ffmpeg -y -txt_format text -txt_page 889 -i /tmp/action.ts -c:s webvtt -map i:0x4c6 /tmp/out.vtt           
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --enable-libass --enable-libfdk_aac --enable-libfreetype --enable-libfontconfig --enable-libfribidi --enable-libmp3lame --enable-librtmp --enable-libsrt --enable-libvpx --enable-libx265 --enable-libx264 --enable-libxml2 --enable-libzvbi --enable-nonfree --enable-openssl --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[h264 @ 0x55841fbacf40] SPS unavailable in decode_picture_timing
[h264 @ 0x55841fbacf40] non-existing PPS 0 referenced
[h264 @ 0x55841fbacf40] SPS unavailable in decode_picture_timing
[h264 @ 0x55841fbacf40] non-existing PPS 0 referenced
[h264 @ 0x55841fbacf40] decode_slice_header error
[h264 @ 0x55841fbacf40] no frame!
...
[h264 @ 0x55841fbacf40] SPS unavailable in decode_picture_timing
[h264 @ 0x55841fbacf40] non-existing PPS 0 referenced
[h264 @ 0x55841fbacf40] SPS unavailable in decode_picture_timing
[h264 @ 0x55841fbacf40] non-existing PPS 0 referenced
[h264 @ 0x55841fbacf40] decode_slice_header error
[h264 @ 0x55841fbacf40] no frame!
    Last message repeated 3 times
[mpegts @ 0x55841fba7fc0] PES packet size mismatch
    Last message repeated 2 times
Input #0, mpegts, from '/tmp/action.ts':
  Duration: 00:00:51.38, start: 94206.543944, bitrate: 15696 kb/s
  Program 78 
    Metadata:
      service_name    : Action HD
      service_provider: A provider
    Stream #0:0[0x336]: Video: h264 ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x39a](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
    Stream #0:2[0x462](fra): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:3[0x4c6](fra,fra): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x52a](qaa): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 192 kb/s
Output #0, webvtt, to '/tmp/out.vtt':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0(fra,fra): Subtitle: webvtt
    Metadata:
      encoder         : Lavc58.54.100 webvtt
Stream mapping:
  Stream #0:3 -> #0:0 (dvb_teletext (libzvbi_teletextdec) -> webvtt (native))
Press [q] to stop, [?] for help
Subtitle packets must have a pts
    Last message repeated 13 times
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

The message "Subtitle packets must have a pts" is displayed in red and the VTT file is empty.

Change History (4)

comment:1 by mkver, 3 years ago

For FFmpeg 4.1.4 you should use the input option -fix_sub_duration; the behaviour of 4.2 will probably be fixed by this patch.

comment:2 by fcaspar77, 3 years ago

Thank you for your quick answer for v4.1.4, it works.

comment:3 by mkver, 3 years ago

Component: ffmpegavformat
Resolution: fixed
Status: newclosed

Should be fixed by Marton in 765c56bfa9037060e36250090880b2961c88f27d.

comment:4 by Carl Eugen Hoyos, 3 years ago

Keywords: subtitle webvtt removed
Version: 4.1.4git-master
Note: See TracTickets for help on using tickets.