You are not logged in.

#1 2024-05-09 20:22:45

O239
Member
Registered: 2024-03-01
Posts: 6

FFmpeg: selecting a track by AND-ing multiple metadata keys

Hi. I'd like to extract subtitles from a bunch of different MKV files using FFmpeg. The following command almost does what I want:

ffmpeg -i video.mkv -map 0:s:m:language:eng subs.srt

But in addition to filtering subtitle tracks based on the language I'd like to filter them based on the title as well. Using the -map option multiple times ORs the match. For example:

ffmpeg -i video.mkv -map 0:s:m:language:eng -map 0:s:m:title:SDH subtitle.srt

will select all tracks that are either English OR have the "SDH" title. Can I somehow make it so that FFmpeg will only select the track that is both English AND has "SDH" in the title?

Bonus question: can I select tracks that don't have a specific metadata key? For example ones that have an empty title.
Edit: figured out the bonus question:

-map -0:s:m:title

will unmatch all subtitle streams that have a title.

Last edited by O239 (2024-05-10 06:44:24)

Offline

Board footer

Powered by FluxBB