I have 3 mp4 files:

  • 1.mp4 - Has video, no audio
  • 2.mp4 - Has video and audio
  • 3.mp4 - Has video and audio

I have created a clips file (clips.txt) for concatenation:

file '1.mp4'
file '2.mp4'
file '3.mp4'

I run the following command line:

ffmpeg -f concat -i "clips.txt" -c:a aac -b:a 160k -y "out.mp4"

The file that is produced has video but no audio, presumably because 1.mp4 has no audio track.

If I rearrange clips.txt so 1.mp4 is not first, out.mp4 has an audio track.

Is there a way of forcing ffmpeg to use audio? I guess it would have to produce a silent audio track for any silent videos.


  • or add a silent track first to the one without any audio, see stackoverflow.com/questions/11779490/… for some ideas.
    – Psycogeek
    Jul 5 '16 at 1:48
  • That was what I was thinking I'd need to do. I was hoping for a cleaner solution, but I decided I'd just stick to that.
    – Phil
    Jul 5 '16 at 6:08

For anyone that stumbles onto this and wants to achieve the same thing as I do, I solved it as follows:

ffmpeg -i "1.mp4" -f lavfi -i aevalsrc=0 -shortest -y "new_1.mp4"

What this says is:

  • Take 1.mp4 (which is the video clip without audio) (-i "1.mp4")
  • Generate the minimum silence required (-f lavfi -i aevalsrc=0 -shortest)
  • Output the result (-y "new_1.mp4")

From here I concatenate as I did before, but replacing "1.mp4" in clips.txt with "new_1.mp4"

  • 4
    For the silent audio make sure to match the channel layout and sample rate of the other inputs. For example, 44.1kHz stereo audio: -i anullsrc=cl=stereo:r=44100 (these are the default settings for the anullsrc filter).
    – llogan
    Jul 5 '16 at 6:26
  • Oh. I didn't know to do that. Thanks!
    – Phil
    Jul 5 '16 at 6:32
  • 4
    Also, consider adding -c:v copy to just re-mux the video instead of also re-encoding it.
    – llogan
    Jul 5 '16 at 6:33

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.