ffmpeg subtitles
Removing all subtitles from a media file
1 | ffmpeg -i input.mkv -map 0 -map -0:s -codec copy output.mkv |
-map input_file_index:stream_type_specifier:stream_index-map 0 -map -0:sto map all the streams except subtitles streams from input 0, use negative mapping.-codec copyselect stream copy mode for the -codec option. This omits decoding and encoding of selected streams.
Adding subtitles to a media file
1 | ffmpeg -i input.mkv -i input.srt -map 0 -map 1:s:0 -codec -copy -metadata:s:s:0 langauge=chi output.mkv |
-map 1:s:0specifying stream index of #1 input file-metadata:s:s:0 langauge=chi-metadata[:metadata_specifier] key=value. firstsis a stream specifier. secondsis a subtitle specifier.0is the stream index.