Opened 4 years ago

Last modified 3 years ago

#8629 open enhancement

Allow additional stream specifier when mapping by stream id

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

Description

Summary of the bug:
Many Blu-ray titles include an AC3 compatibility track in addition to a TrueHD/Atmos one. The problem is that they are identified by the same MPEG-TS PID and there's no way to select one or the other, as you can see below. In fact when using -map i:0x1100 ffmpeg tries to map both of them, while -map i:0x1100:0 gives the following error: Stream map 'i:0x1100:0' matches no streams.. I think a good idea could be to add the ability to specify an additional stream specifier.

How to reproduce:

% ffmpeg -y -i sample.m2ts -map i:0x1100 -c copy ffmpeg version N-97450-g64b80cb 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-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.101 / 58. 42.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 79.100 /  7. 79.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mpegts @ 0x5592f8b6fdc0] start time for stream 7 is not set in estimate_timings_from_pts
[mpegts @ 0x5592f8b6fdc0] start time for stream 8 is not set in estimate_timings_from_pts
[mpegts @ 0x5592f8b6fdc0] start time for stream 9 is not set in estimate_timings_from_pts
[mpegts @ 0x5592f8b6fdc0] start time for stream 10 is not set in estimate_timings_from_pts
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 2, dts = 2903280).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 3, dts = 2924985).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 2, dts = 2903280).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 3, dts = 2924985).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 4, dts = 2906160).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 5, dts = 2906160).
[mpegts @ 0x5592f8b6fdc0] PES packet size mismatch
[mpegts @ 0x5592f8b6fdc0] Packet corrupt (stream = 6, dts = 2906160).
[mpegts @ 0x5592f8b6fdc0] stream 0 : no PTS found at end of file, duration not set
[mpegts @ 0x5592f8b6fdc0] Could not find codec parameters for stream 7 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x5592f8b6fdc0] Could not find codec parameters for stream 8 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x5592f8b6fdc0] Could not find codec parameters for stream 9 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x5592f8b6fdc0] Could not find codec parameters for stream 10 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'sample.m2ts':
  Duration: 00:00:20.90, start: 11.635833, bitrate: 20072 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: hevc (Main 10) (HDMV / 0x564D4448), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 23.98 tbc
    Stream #0:1[0x1100]: Audio: truehd (AC-3 / 0x332D4341), 48000 Hz, 7.1, s32 (24 bit)
    Stream #0:2[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Stream #0:3[0x1101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 320 kb/s
    Stream #0:4[0x1102]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:5[0x1103]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:6[0x1104]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:7[0x12a0]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:8[0x12a1]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:9[0x12a2]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:10[0x12a3]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:11[0x12a4]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:12[0x12a5]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:13[0x12a6]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:14[0x12a7]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
[truehd @ 0x5592f92ba840] truehd files have exactly one stream
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
    Last message repeated 1 times
% ffmpeg -y -i sample.m2ts -map i:0x1100:0 -c copy sample_out.thd
ffmpeg version N-97450-g64b80cb 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-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.101 / 58. 42.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 79.100 /  7. 79.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mpegts @ 0x563c5ce58dc0] start time for stream 7 is not set in estimate_timings_from_pts
[mpegts @ 0x563c5ce58dc0] start time for stream 8 is not set in estimate_timings_from_pts
[mpegts @ 0x563c5ce58dc0] start time for stream 9 is not set in estimate_timings_from_pts
[mpegts @ 0x563c5ce58dc0] start time for stream 10 is not set in estimate_timings_from_pts
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 2, dts = 2903280).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 3, dts = 2924985).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 2, dts = 2903280).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 3, dts = 2924985).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 4, dts = 2906160).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 5, dts = 2906160).
[mpegts @ 0x563c5ce58dc0] PES packet size mismatch
[mpegts @ 0x563c5ce58dc0] Packet corrupt (stream = 6, dts = 2906160).
[mpegts @ 0x563c5ce58dc0] stream 0 : no PTS found at end of file, duration not set
[mpegts @ 0x563c5ce58dc0] Could not find codec parameters for stream 7 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x563c5ce58dc0] Could not find codec parameters for stream 8 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x563c5ce58dc0] Could not find codec parameters for stream 9 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x563c5ce58dc0] Could not find codec parameters for stream 10 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'sample.m2ts':
  Duration: 00:00:20.90, start: 11.635833, bitrate: 20072 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: hevc (Main 10) (HDMV / 0x564D4448), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 23.98 tbc
    Stream #0:1[0x1100]: Audio: truehd (AC-3 / 0x332D4341), 48000 Hz, 7.1, s32 (24 bit)
    Stream #0:2[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Stream #0:3[0x1101]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 320 kb/s
    Stream #0:4[0x1102]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:5[0x1103]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:6[0x1104]: Audio: eac3 (AC-3 / 0x332D4341), 48000 Hz, 7.1, fltp, 896 kb/s
    Stream #0:7[0x12a0]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:8[0x12a1]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:9[0x12a2]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:10[0x12a3]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:11[0x12a4]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:12[0x12a5]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:13[0x12a6]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
    Stream #0:14[0x12a7]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
[mpegts @ 0x563c5ce58dc0] Invalid stream specifier: i:0x1100:0.
    Last message repeated 29 times
Stream map 'i:0x1100:0' matches no streams.
To ignore this, add a trailing '?' to the map.

Attachments (1)

sample.m2ts (2.5 MB ) - added by Rapper_skull 4 years ago.

Change History (6)

comment:1 by Carl Eugen Hoyos, 4 years ago

Why is it a disadvantage to use -map 0:1?

by Rapper_skull, 4 years ago

Attachment: sample.m2ts added

in reply to:  1 comment:2 by Rapper_skull, 4 years ago

Replying to cehoyos:

Why is it a disadvantage to use -map 0:1?

That the order of the streams is not always known

comment:3 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedffmpeg
Priority: normalwish
Status: newopen

comment:4 by Rapper_skull, 4 years ago

I noticed I messed up the command in the OP, here it is:

% ffmpeg -y -i sample.m2ts -map i:0x1100 -c copy sample_out.thd

comment:5 by Balling, 3 years ago

But ac3 is a part of TrueHD+Atmos... And is needed to decode EAC3.

Note: See TracTickets for help on using tickets.