inline Dropping streams from a file
Originally published on May 1st, 2020 (Last updated on May 1st, 2020)
To remove streams (video, audio, subtitles, etz) from a file, create a new file and specify the appropriate mapping of streams:
# Keep all Video streams, only take Audio Stream 1 and 2
ffmpeg -i <file> -map v -map a:1 -map a:2 -c copy <out>
Selecting specific streams is done by specifying them to the -map
option in the appropriate format: input:type:index
where:
- input specifies the index of the input file. Only required if multiple input files are given
- type is the type of stream:
a
for Audio,v
for Video,s
for Subtitles - index is the 0‑based index of the stream in the input file
The -map
argument is an output argument, which means it must be specified after all input files and arguments are specified. If it’s specified, all streams NOT explicitly mapped are dropped from the output file.
To map all streams as in the input file use -map 0
.
Comments
No comment section here 😄
You can reach me over at @knuth_dev or send me an Email.