The problem
The issue is your usage of -map
. You're telling ffmpeg
to map steams 0:2
and 0:1
which in this input correspond to the aac
audio stream and the mjpeg
video stream.
Solutions
Use the default stream selection
You can omit the -map
options and rely on the default stream selection behavior:
By default,
ffmpeg
includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file. It picks the "best" of each based upon the following criteria:
- video – the stream with the highest resolution
- audio – the stream with the most channels
- subtitles – the first subtitle stream
In the case where several streams of the same type rate equally, the stream with the lowest index is chosen.
Use proper mapping
If the default stream selection is not acceptable for you then you'll have to use the correct -map
options for each input.
A better method than explicitly selecting a particular stream by index number is to add a stream specifier.
Examples
Choose all video streams and all audio streams from the first (and only) input:
ffmpeg -i input0 -map 0:v -map 0:a … output
- Note that
ffmpeg
starts counting from 0.
Choose the first video stream from the second input and the third audio stream from the first input:
ffmpeg -i input0 -i input1 -map 1:v:0 -map 0:a:2 … output
Use a negative mapping to choose all streams from input 0 except any subtitle streams:
ffmpeg -i input0 -map 0 -map -0:s … output