Opened 3 hours ago

Last modified 3 hours ago

#11248 new defect

mapping of optional streams selected by language broken

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

Description

Summary of the bug:

I used to use -map 0:s:m:language:eng? to map only english subtitles into the output, but don't fail if there is no such subtitle. This worked fine until I updated ffmpeg to the latest version (#9601 also suggests that this used to work).

Using either -map 0:s:0? or -map 0:s:m:language:eng, i.e. optional map by number or mandatory map by language, works as expected.

How to reproduce:

% ffmpeg -i 0.mkv -c copy -map '0:s:m:language:eng?' out.srt
ffmpeg version N-117538-g9ce63e65d6-20241015 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.120_4d36f27)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-openssl --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs='-ldl -lgomp' --extra-ldflags=-pthread --extra-ldexeflags=-pie --cc=x86_64-ffbuild-linux-gnu-gcc --cxx=x86_64-ffbuild-linux-gnu-g++ --ar=x86_64-ffbuild-linux-gnu-gcc-ar --ranlib=x86_64-ffbuild-linux-gnu-gcc-ranlib --nm=x86_64-ffbuild-linux-gnu-gcc-nm --extra-version=20241015
  libavutil      59. 43.100 / 59. 43.100
  libavcodec     61. 22.100 / 61. 22.100
  libavformat    61.  9.100 / 61.  9.100
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.100 / 10.  6.100
  libswscale      8.  6.100 /  8.  6.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
Input #0, matroska,webm, from '0.mkv':
[... listing of all input streams ...]
Stream map '' matches no streams.
To ignore this, add a trailing '?' to the map.
Failed to set value '0:a:m:language:eng?' for option 'map': Invalid argument
Error parsing options for output file out.mkv.
Error opening output files: Invalid argument

Change History (1)

comment:1 by Jakob, 3 hours ago

addition: I fiddled a little more and found that it seems to work when inserting a : seperator between the language and the optional modifier ?, i.e. `-map '0:s:m:language:eng:?'. Maybe it was always intended to only work this way, but I couldn't find something about that in the docs.

Note: See TracTickets for help on using tickets.