avconv -i in1.mp4 -i in2.mp4 -map 0:a -map 1:v -y -q 1 out.mp4
-map
– specifies the source track to be included in the output file (if no maps are specified, avconv will simply convert the first file to the output file format).
–map 0: a
– audio track from the first file (counting from zero).
-map 1: v
– video track from the second.
New in version 0.9 -filter_complex
This option will determine the order of filters for complex (complex) operations.
Works fine with files when they have the same frame rate.
The filter is described by a line that looks something like this:
[in1] [in2] transform [out]
At the input, this is, in fact, the same thing that we write in -map, for example [0: a] [1: a] – the audio channels of the first and second clips.
At the output, we give a name to the newly created channel after the performed transformations, for example, mix_a. It can also be used in map in the future or as the name of the stream at the input of the next transformation.
By default, the transformation includes all incoming streams (or the first stream if the filter accepts only one), so they can be omitted. The resulting channel becomes the default channel for the resulting file, so in most cases, it can also be discarded.
Transformation operations can be conditionally divided into “generators” – they do not accept anything at the input, but only create a stream with specified properties, “filters” – take one stream as input and transform it and “mixers” – take several streams as input and connect them.
There may also be several streams at the output, for example, if the filter splits stereo into two mono tracks, they also need to be described with the [out1] [out2] list, etc.