Extract stuff from .mkv with ffmpeg
Full documentation: https://ffmpeg.org/ffmpeg.html
ffmpeg -i input.mkv
track indexes are zero-based.
v - video
a - audio
s - subtitles
t - attachments
d - data
m - metadata
ffmpeg -i input.mkv -map 0:type -map 0:type -c copy output.mkv
ffmpeg -i input.mkv -map 0:type:index -map 0:type:index -c copy output.mkv
pick all video tracks, second audio track and third subtitle track:
ffmpeg -i input.mkv -map 0:v -map 0:a:1 -map 0:s:2 -c copy output.mkv
only pick first video, audio and subtitle tracks but keep all attachments:
ffmpeg -i "$i" -map 0:v:0 -map 0:a:0 -map 0:s:0 -map 0:t -c copy
ffmpeg -i input.mkv -map 0 -map -0:type:index -c output.mkv
keep all tracks except first audio and first subtitle tracks:
ffmpeg -i input.mkv -map 0 -map -0:a:0 -map -0:s:0 -c output.mkv
ffmpeg -i input.mkv -map 0:m:key:value -c:s copy|format output.srt
ffmpeg -i input.mkv -map 0:m:language:eng -c:s copy output.srt
ffmpeg -i input.mkv -map 0:m:title:SDH -c:s copy output.srt
ffmpeg -i input.mkv -map 0:m:key:value -c:s srt output.srt
extract subtitles
for i in *.mkv; do ffmpeg -i "$i" -map 0:m:key:value -c:s copy "${i%.*}.srt"; done
pick tracks
for i in *.mkv; do ffmpeg -i "$i" -map 0:v -map 0:a:0 -map 0:s:0 -c copy "_${i}"; done
omit tracks
for i in *.mkv; do ffmpeg -i "$i" -map 0 -map -0:a:0 -c copy "_${i}"; done
ffmpeg -v 24 -stats ...