Sorry if my question is too noobish, this is my first question.

What I have is:

An mp4 movie with a video stream and an audio stream.

What I want in the output:

Is an mp4 file containing: the same video stream + the same audio stream + the same video stream with a lower bit-rate

Can anyone please tell me the appropriate ffmpeg command?

  • 1
    What are you hoping to accomplish with this? Generally you would make two separate files for this kind of thing since either the client would still have to download both or the server can simply switch between which file it is streaming. – AJ Henderson Apr 10 '14 at 15:11

Answering the question as asked,

ffmpeg -i input.mp4 -map 0:v -map 0:a -map 0:v \
-c:v:0 copy -c:v:1 libx264 -b:v:1 <lower-bitrate> -c:a copy -movflags +faststart out.mp4

The lower-bitrate version of the video is the third stream. Players typically will play the original video which is the first stream in the output.


Not sure off the top of my head how to do it on the fly (with multiple different video codec settings for different video streams going into the same output container).

However, with 2 input files, this should work to mux all streams from multiple input file into a single output file. (parallel streams / multiple "programs", NOT concatenated.)

ffmpeg -i in1.mp4 -i in2.mp4 -map 0 -map 1 -codec copy -movflags +faststart out.mp4
  • Use -map 1:v instead of -map 1 to induct only the video stream from the 2nd file. – Gyan May 7 '15 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.