Opened 3 years ago

Closed 3 years ago

Last modified 18 months ago

#5472 closed defect (needs_more_info)

ffmpeg: invalid dts - ffmpeg can not handle pgs subtitles

Reported by: susnux Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: pgssub
Cc: hawken@thehawken.org Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I have muxed a bluray into a mkv using ffmpeg.
But now ffmpeg is unable to work with that mkv because of the included pgs subtitle.

(Subtitles are working, checked it with mpv).

ffmpeg error:

[matroska @ 0x1f4af20] Application provided invalid, non monotonically increasing dts to muxer in stream 4: 14875 >= 14874
av_interleaved_write_frame(): Invalid argument

ffprobe gives:

[matroska,webm @ 0x1e60cc0] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options

How to reproduce:
(even -fix_sub_duration does not help)

% ffmpeg -i in.mkv -map 0 -c copy a.mkv
ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (SUSE Linux)

...

Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(ger): Audio: dts (DTS-HD HRA) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side) (24 bit) (default)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:2(eng): Audio: dts (DTS-HD HRA) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side) (24 bit)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:3(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 224 kb/s
    Stream #0:4(ger): Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF) (default)
    Metadata:
      title           : Vollständig

Attached some subtitle packages from ffprobe -show_packets.

Attachments (2)

packages.txt (1.1 KB) - added by susnux 3 years ago.
Some subtitle packages from ffprobe output
sample1.tar.gz (645.7 KB) - added by hawken 3 years ago.
Test data

Download all attachments as: .zip

Change History (15)

Changed 3 years ago by susnux

Some subtitle packages from ffprobe output

comment:1 Changed 3 years ago by cehoyos

  • Keywords pgssub added

Assuming this is not the same issue as the one I described in ticket #5474 (I don't know), this is missing all necessary information: Please test current FFmpeg git head, provide the command line you tested together with the complete, uncut console output and upload the input sample.

comment:2 Changed 3 years ago by susnux

Tested also the current git head (static ffmpeg build from ffmpeg website), same result.

Note: I think the real issue is when ripping the bluray using ffmpeg.
Because if I extract it with makeMKV it works (ffmpeg can then mux the pgs, so it seems ffmpeg breaks the ffmpeg while extracting).

Note 2: I can not provide the video file due to legal reasons, in my country private copies are allowed (e.g. I rip blurays to watch them on my laptop which has no bd drive), but I am not allowed to share them.

Complete console output:

% ffmpeg -i a.mkv -map 0 -c copy b.mkv             :(
ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (SUSE Linux)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-runtime-cpudetect --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-pic --enable-pthreads --enable-vaapi --enable-vdpau --disable-decoder=dca --enable-libdcadec --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libtwolame --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[matroska,webm @ 0x1ee3520] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle): unspecified size                                                                                                                      
Consider increasing the value for the 'analyzeduration' and 'probesize' options                                        
Input #0, matroska,webm, from 'a.mkv':
  Metadata:
    encoder         : libebml v1.3.3 + libmatroska v1.4.4
    creation_time   : 2016-04-22 01:22:25
  Duration: 01:59:29.50, start: 0.000000, bitrate: 20864 kb/s
    Chapter #0:0: start 0.000000, end 374.458333
    Chapter #0:1: start 374.458333, end 734.375000
    Chapter #0:2: start 734.375000, end 1113.416667
    Chapter #0:3: start 1113.416667, end 1404.125000
    Chapter #0:4: start 1404.125000, end 1804.916667
    Chapter #0:5: start 1804.916667, end 2184.250000
    Chapter #0:6: start 2184.250000, end 2427.291667
    Chapter #0:7: start 2427.291667, end 2778.166667
    Chapter #0:8: start 2778.166667, end 3114.250000
    Chapter #0:9: start 3114.250000, end 3377.791667
    Chapter #0:10: start 3377.791667, end 3695.291667
    Chapter #0:11: start 3695.291667, end 4015.375000
    Chapter #0:12: start 4015.375000, end 4186.000000
    Chapter #0:13: start 4186.000000, end 4512.625000
    Chapter #0:14: start 4512.625000, end 4807.208333
    Chapter #0:15: start 4807.208333, end 5074.041667
    Chapter #0:16: start 5074.041667, end 5380.333333
    Chapter #0:17: start 5380.333333, end 5750.041667
    Chapter #0:18: start 5750.041667, end 6137.333333
    Chapter #0:19: start 6137.333333, end 6474.333333
    Chapter #0:20: start 6474.333333, end 6825.041667
    Chapter #0:21: start 6825.041667, end 7169.500000
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
    Stream #0:1(ger): Audio: dts (DTS-HD HRA), 48000 Hz, 5.1(side), s32p (24 bit) (default)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:2(eng): Audio: dts (DTS-HD HRA), 48000 Hz, 5.1(side), s32p (24 bit)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:3(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
    Stream #0:4(ger): Subtitle: hdmv_pgs_subtitle (default)
    Metadata:
      title           : Vollständig
Output #0, matroska, to 'b.mkv':
  Metadata:
    encoder         : Lavf57.25.100
    Chapter #0:0: start 0.000000, end 374.458333
    Chapter #0:1: start 374.458333, end 734.375000
    Chapter #0:2: start 734.375000, end 1113.416667
    Chapter #0:3: start 1113.416667, end 1404.125000
    Chapter #0:4: start 1404.125000, end 1804.916667
    Chapter #0:5: start 1804.916667, end 2184.250000
    Chapter #0:6: start 2184.250000, end 2427.291667
    Chapter #0:7: start 2427.291667, end 2778.166667
    Chapter #0:8: start 2778.166667, end 3114.250000
    Chapter #0:9: start 3114.250000, end 3377.791667
    Chapter #0:10: start 3377.791667, end 3695.291667
    Chapter #0:11: start 3695.291667, end 4015.375000
    Chapter #0:12: start 4015.375000, end 4186.000000
    Chapter #0:13: start 4186.000000, end 4512.625000
    Chapter #0:14: start 4512.625000, end 4807.208333
    Chapter #0:15: start 4807.208333, end 5074.041667
    Chapter #0:16: start 5074.041667, end 5380.333333
    Chapter #0:17: start 5380.333333, end 5750.041667
    Chapter #0:18: start 5750.041667, end 6137.333333
    Chapter #0:19: start 6137.333333, end 6474.333333
    Chapter #0:20: start 6474.333333, end 6825.041667
    Chapter #0:21: start 6825.041667, end 7169.500000
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(ger): Audio: dts (DTS-HD HRA) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side) (24 bit) (default)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:2(eng): Audio: dts (DTS-HD HRA) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side) (24 bit)
    Metadata:
      title           : 5.1 DTS-HRA
    Stream #0:3(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 224 kb/s
    Stream #0:4(ger): Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF) (default)
    Metadata:
      title           : Vollständig
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x2020ba0] Application provided invalid, non monotonically increasing dts to muxer in stream 4: 14875 >= 14874
av_interleaved_write_frame(): Invalid argument
frame=  358 fps=0.0 q=-1.0 Lsize=   23484kB time=00:00:15.00 bitrate=12818.4kbits/s speed= 136x    
video:15586kB audio:7870kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.118415%
Conversion failed!

comment:3 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed

Feel free to reopen this ticket if you can provide an input sample.

comment:4 Changed 3 years ago by susnux

Ok, I just want to add: It must be something from ffmpeg. If I extract the pgs from the m2ts with mkvmerge ffmpeg can handle it without problems...

Changed 3 years ago by hawken

Test data

comment:5 Changed 3 years ago by hawken

  • Resolution needs_more_info deleted
  • Status changed from closed to reopened

I have added some test data..
Contents of sample1.txt:

Other information:
mkvmerge seems to get it right:

mkvmerge -o sample1-working.mkv sample1.mkv sample1.pgs

Command line:

ffmpeg -i sample1.mkv -i sample1.pgs -map 0 -map 1 -c copy sample1-broken.mkv

Version & result:

ffmpeg version N-79983-g638e294 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-17) 20160429
  configuration: --prefix=/usr/local/ --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-avisynth --enable-chromaprint --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-libfdk-aac --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libzmq --enable-libzvbi --enable-netcdf --enable-openal --enable-opencl --enable-opengl --arch=x86_64 --extra-cflags='-march=native'
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 41.102 / 57. 41.102
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'sample1.mkv':
  Metadata:
    ENCODER         : Lavf57.36.100
  Duration: 00:00:09.88, start: 0.000000, bitrate: 531 kb/s
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn (default)
    Metadata:
      ENCODER         : Lavc57.41.102 libx265
      DURATION        : 00:00:09.880000000
Input #1, sup, from 'sample1.pgs':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Subtitle: hdmv_pgs_subtitle, 1920x1080
[matroska @ 0x17ffba0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, matroska, to 'sample1-broken.mkv':
  Metadata:
    encoder         : Lavf57.36.100
    Stream #0:0: Video: hevc, yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn (default)
    Metadata:
      ENCODER         : Lavc57.41.102 libx265
      DURATION        : 00:00:09.880000000
    Stream #0:1: Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF), 1920x1080
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x17ffba0] Application provided invalid, non monotonically increasing dts to muxer in  stream 1: 47721795 >= 521
 av_interleaved_write_frame(): Invalid argument
 frame=  247 fps=0.0 q=-1.0 Lsize=     644kB time=13:15:21.79 bitrate=   0.1kbits/s speed=1.98e+07x    
 video:638kB audio:0kB subtitle:3kB other streams:0kB global headers:0kB muxing overhead: 0.586390%
 Conversion failed!
Version 1, edited 3 years ago by hawken (previous) (next) (diff)

comment:6 Changed 3 years ago by hawken

  • Cc hawken@thehawken.org added

comment:7 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from reopened to closed

Feel free to reopen if you can provide a.mkv.

comment:8 Changed 3 years ago by hawken

  • Resolution needs_more_info deleted
  • Status changed from closed to reopened

It's not exactly a.mkv but it should be equivalent.
I don't really get it though. After 5 months, latest ffmpeg from git has the same problem. Anyone could use the already attached files to produce a broken file.

I hope this somehow helps.

Last edited 3 years ago by hawken (previous) (diff)

comment:9 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from reopened to closed

Please provide both the command line and the console output for the sample you just uploaded and tested.

comment:10 Changed 3 years ago by hawken

I'll update the file in a second.

hawken@athena:~/sample1$ ffmpeg -i sample1.mkv -i sample1.pgs -map 0 -map 1 -c copy sample1-broken.mkv
ffmpeg version N-81874-ge705d62 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.1.1 (Debian 6.1.1-11) 20160802
  configuration: --prefix=/usr/local/ --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-avisynth --enable-chromaprint --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libzmq --enable-libzvbi --enable-netcdf --enable-openal --enable-opencl --enable-opengl --arch=x86_64 --extra-cflags='-march=native'
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 60.101 / 57. 60.101
  libavformat    57. 51.102 / 57. 51.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'sample1.mkv':
  Metadata:
    ENCODER         : Lavf57.36.100
  Duration: 00:00:09.88, start: 0.000000, bitrate: 531 kb/s
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
    Metadata:
      ENCODER         : Lavc57.41.102 libx265
      DURATION        : 00:00:09.880000000
Input #1, sup, from 'sample1.pgs':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Subtitle: hdmv_pgs_subtitle, 1920x1080
Output #0, matroska, to 'sample1-broken.mkv':
  Metadata:
    encoder         : Lavf57.51.102
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      ENCODER         : Lavc57.41.102 libx265
      DURATION        : 00:00:09.880000000
    Stream #0:1: Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF), 1920x1080
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x1c05e20] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 47721795 >= 521
av_interleaved_write_frame(): Invalid argument
frame=  247 fps=0.0 q=-1.0 Lsize=     644kB time=13:15:21.79 bitrate=   0.1kbits/s speed=2.76e+07x    
video:638kB audio:0kB subtitle:3kB other streams:0kB global headers:1kB muxing overhead: 0.579988%
Conversion failed!

comment:11 Changed 3 years ago by hawken

  • Resolution needs_more_info deleted
  • Status changed from closed to reopened

comment:12 follow-up: Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from reopened to closed

Please do not upload output files, this is never welcome.

Only reopen this ticket if you can provide the sample a.mkv.

comment:13 in reply to: ↑ 12 Changed 18 months ago by tesseract

Replying to cehoyos:

Please do not upload output files, this is never welcome.

Only reopen this ticket if you can provide the sample a.mkv.

Hello,

I ran into the same problem.
As I'm relatively new to ffmpeg and all that media conversion stuff, I used ffmpeg to copy from a BluRay? .m2ts to .mkv (instead of using mkvmerge on the .mpls file).
The result is a file with the problem described above.
Also I noticed lots of metadata gets lost, i.e. language of the subtitles.

I've uploaded a sample here:
https://www.dropbox.com/s/j0o789ja4k9b2f1/covenant-m2ts-sample.mkv?dl=0

The cmdline to build this was a simple -codec copy as far as I remember.

ffmpeg -version
ffmpeg version 3.4-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

Best regards

Note: See TracTickets for help on using tickets.