0
votes

I'm attempting to combine and audio file (mp3) with a video created with ffmpeg. The video is created from several smaller clips using:

ffmpeg -y -f concat -auto_convert 1 -i videos.txt -c copy -an -sn video.mp4

videos.txt contains a list of videos to combine. This video is created correctly and plays fine. Next I am trying to add an audio track to the video. I've checked and the audio file plays correctly however when I add it using the command below the mp4 produced is corrupt and no longer valid for playback:

ffmpeg -y -i video.mp4 audio.aac final.mp4

Any ideas, I'm new to using ffmpeg and not sure what half the output means and what is relevant but I don't see anything that looks like errors.

1

1 Answers

1
votes

You're missing an -i:

ffmpeg -i video.mp4 -i audio.aac -c copy -shortest final.mp4

I added:

  • -c copy to stream copy because I assume you only want to mux the audio and not re-encode everything.

  • -shortest so the output ends when the shortest inputs ends.