Opened 13 months ago

Last modified 13 months ago

#8908 new defect

PSG subtitles timestamps are wrong when reading from stdin and not exporting video too

Reported by: Rapper_skull Owned by:
Priority: important Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Hi, I was trying to extract hdmv_pgs_subtitle from a Blu-ray m2ts file but I found out that the timestamps were wrong and in fact very different from the output of eac3to. In fact, opening the files with an Hex Editor revealed that the first timestamp was very close to 0 when output with ffmpeg, while correct in the file produced by eac3to.
Since this is a timing issue, I tried to output also the video alongside the .sup file (on /dev/null) and in fact the problem is solved. My thought is that without a video "to sync with" the first caption line is given timestamp zero or near-zero and the others will follow.
Unfortunately using -copyts will not work (wrong timestamps) and -copyts -start_at_zero does the same thing as before.
Then, while preparing a test file to post here, I realized the problem is that I'm using cat and reading from stdin. In fact if I use the name of the file ffmpeg works fine without issues. Unfortunately I can't directly specify the file name, because I need to concatenate many input files one after another (hence cat).
Finally I would like to point out that even if the workaround works, the file is not exactly the same as the one produced by eac3to. In fact timestamps are a little smaller: it starts with a difference of 1 in the timestamp, and grows to about 20000 (corresponding to a 22 ms difference) over the course of a 2.5h movie. Another difference is that the second pts is present in the ffmpeg output.

How to reproduce:

% cat test.m2ts | ffmpeg -i - -y -c copy -map i:0x1200 "eng_test_wrong.sup"
ffmpeg version N-99352-gd8ce8e8 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/home/rapperskull/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/rapperskull/ffmpeg_build/include --extra-ldflags=-L/home/rapperskull/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/rapperskull/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[mpegts @ 0x7fffd71f7700] Failed to open codec in avformat_find_stream_info
    Last message repeated 1 times
[NULL @ 0x7fffd72422c0] ignoring invalid SAR: 40/33
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 15 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 16 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 17 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 18 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 19 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 20 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 21 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 22 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 23 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 24 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 25 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 26 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 27 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd71f7700] Could not find codec parameters for stream 28 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'pipe:':
  Duration: N/A, start: 4198.000000, bitrate: N/A
  Program 1
    Stream #0:0[0x1011]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0:1[0x1100]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:2[0x1101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:3[0x1102]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x1103]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:5[0x1104]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:6[0x1105]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:7[0x1106]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:8[0x1107]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:9[0x1108]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:10[0x1109]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:11[0x110a]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:12[0x110b]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:13[0x110c]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:14[0x110d]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:15[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:16[0x1201]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:17[0x1202]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:18[0x1203]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:19[0x1204]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:20[0x1205]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:21[0x1206]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:22[0x1207]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:23[0x1208]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:24[0x1209]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:25[0x120a]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:26[0x120b]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:27[0x120c]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:28[0x120d]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:29[0x120e]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:30[0x120f]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:31[0x1210]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:32[0x1211]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:33[0x1212]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:34[0x1a00]: Audio: dts (DTS Express) ([162][0][0][0] / 0x00A2), 48000 Hz, stereo, fltp, 187 kb/s
    Stream #0:35[0x1b00]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(smpte170m/smpte170m/unknown, progressive), 720x480 [SAR 40:33 DAR 20:11], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Output #0, sup, to 'eng_test_wrong.sup':
  Metadata:
    encoder         : Lavf58.58.100
    Stream #0:0: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Stream mapping:
  Stream #0:15 -> #0:0 (copy)
size=      44kB time=00:00:02.85 bitrate= 127.4kbits/s speed=0.843x
video:0kB audio:0kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 0.286400%
% ffmpeg -i test.m2ts -y -c copy -map i:0x1200 "eng_test_good.sup"
ffmpeg version N-99352-gd8ce8e8 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/home/rapperskull/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/rapperskull/ffmpeg_build/include --extra-ldflags=-L/home/rapperskull/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/rapperskull/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[mpegts @ 0x7fffb9f94700] Failed to open codec in avformat_find_stream_info
    Last message repeated 1 times
[NULL @ 0x7fffb9fdd200] ignoring invalid SAR: 40/33
[mpegts @ 0x7fffb9f94700] start time for stream 15 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 16 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 17 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 18 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 19 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 20 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 21 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 22 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 23 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 24 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 25 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 26 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 27 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] start time for stream 28 is not set in estimate_timings_from_pts
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 1, dts = 385432800).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 2, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 3, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 4, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 5, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 6, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 7, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 8, dts = 385432800).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 9, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 10, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 11, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 12, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 13, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 14, dts = 385443360).
[mpegts @ 0x7fffb9f94700] PES packet size mismatch
[mpegts @ 0x7fffb9f94700] Packet corrupt (stream = 34, dts = 385438560).
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 15 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 16 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 17 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 18 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 19 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 20 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 21 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 22 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 23 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 24 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 25 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 26 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 27 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffb9f94700] Could not find codec parameters for stream 28 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'test.m2ts':
  Duration: 00:01:25.42, start: 4198.000000, bitrate: 34372 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0:1[0x1100]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:2[0x1101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:3[0x1102]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x1103]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:5[0x1104]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:6[0x1105]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:7[0x1106]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:8[0x1107]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:9[0x1108]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:10[0x1109]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:11[0x110a]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:12[0x110b]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:13[0x110c]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:14[0x110d]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:15[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:16[0x1201]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:17[0x1202]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:18[0x1203]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:19[0x1204]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:20[0x1205]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:21[0x1206]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:22[0x1207]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:23[0x1208]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:24[0x1209]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:25[0x120a]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:26[0x120b]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:27[0x120c]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:28[0x120d]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:29[0x120e]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:30[0x120f]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:31[0x1210]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:32[0x1211]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:33[0x1212]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:34[0x1a00]: Audio: dts (DTS Express) ([162][0][0][0] / 0x00A2), 48000 Hz, stereo, fltp, 187 kb/s
    Stream #0:35[0x1b00]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(smpte170m/smpte170m/unknown, progressive), 720x480 [SAR 40:33 DAR 20:11], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Output #0, sup, to 'eng_test_good.sup':
  Metadata:
    encoder         : Lavf58.58.100
    Stream #0:0: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Stream mapping:
  Stream #0:15 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=      44kB time=00:01:21.60 bitrate=   4.5kbits/s speed=10.2x
video:0kB audio:0kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 0.286400%
% cat test.m2ts | ffmpeg -i - -y -c copy -map i:0x1011 -f vc1 /dev/null -c copy -map i:0x1200 "eng_test.sup"
ffmpeg version N-99352-gd8ce8e8 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/home/rapperskull/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/rapperskull/ffmpeg_build/include --extra-ldflags=-L/home/rapperskull/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/rapperskull/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[mpegts @ 0x7fffd0a96880] Failed to open codec in avformat_find_stream_info
    Last message repeated 1 times
[NULL @ 0x7fffd0ae1440] ignoring invalid SAR: 40/33
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 15 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 16 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 17 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 18 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 19 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 20 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 21 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 22 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 23 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 24 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 25 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 26 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 27 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7fffd0a96880] Could not find codec parameters for stream 28 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'pipe:':
  Duration: N/A, start: 4198.000000, bitrate: N/A
  Program 1
    Stream #0:0[0x1011]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0:1[0x1100]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:2[0x1101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:3[0x1102]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x1103]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:5[0x1104]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:6[0x1105]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:7[0x1106]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:8[0x1107]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
    Stream #0:9[0x1108]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:10[0x1109]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:11[0x110a]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:12[0x110b]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:13[0x110c]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:14[0x110d]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:15[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:16[0x1201]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:17[0x1202]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:18[0x1203]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:19[0x1204]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:20[0x1205]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:21[0x1206]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:22[0x1207]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:23[0x1208]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:24[0x1209]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:25[0x120a]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:26[0x120b]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:27[0x120c]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:28[0x120d]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:29[0x120e]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:30[0x120f]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:31[0x1210]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:32[0x1211]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:33[0x1212]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:34[0x1a00]: Audio: dts (DTS Express) ([162][0][0][0] / 0x00A2), 48000 Hz, stereo, fltp, 187 kb/s
    Stream #0:35[0x1b00]: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(smpte170m/smpte170m/unknown, progressive), 720x480 [SAR 40:33 DAR 20:11], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Output #0, vc1, to '/dev/null':
  Metadata:
    encoder         : Lavf58.58.100
    Stream #0:0: Video: vc1 (Advanced) (VC-1 / 0x312D4356), yuv420p(bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Output #1, sup, to 'eng_test.sup':
  Metadata:
    encoder         : Lavf58.58.100
    Stream #1:0: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:15 -> #1:0 (copy)
frame= 2046 fps=595 q=-1.0 Lsize=  231308kB time=00:01:25.29 bitrate=22215.9kbits/s speed=24.8x
video:231308kB audio:0kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: unknown

I truncated the m2ts file to include the first two captions, but I don't know how to post it, since it's still 350 MB.

Attachments (4)

eng_test.sup (44.5 KB ) - added by Rapper_skull 13 months ago.
eng_test_good.sup (44.5 KB ) - added by Rapper_skull 13 months ago.
eng_test_wrong.sup (44.5 KB ) - added by Rapper_skull 13 months ago.
eng_eac3to.sup (44.5 KB ) - added by Rapper_skull 13 months ago.

Download all attachments as: .zip

Change History (6)

by Rapper_skull, 13 months ago

Attachment: eng_test.sup added

by Rapper_skull, 13 months ago

Attachment: eng_test_good.sup added

by Rapper_skull, 13 months ago

Attachment: eng_test_wrong.sup added

by Rapper_skull, 13 months ago

Attachment: eng_eac3to.sup added

comment:1 by Rapper_skull, 13 months ago

Summary: PSG subtitles timestamps not starting at 0 when not exporting video tooPSG subtitles timestamps are wrong when reading from stdin and not exporting video too

comment:2 by Rapper_skull, 13 months ago

Update:
I also tried the bash inline syntax ffmpeg -i <(cat test.m2ts), but the timestamps are still wrong.
I tried to use the concat protocol as described here, but unfortunately there's a bigger issue: starting from the second file all timings are wrong (at the end I get a 5 seconds difference).
This problem is present even if I manually join the files with cat and then use the result as an input. The only way is to resort to the trick of autputting the video to /dev/null. Even -fix_sub_duration -copyts -start_at_zero does nothing.

Note: See TracTickets for help on using tickets.