FFMPEG: How can I combine multiple video files into one and replace audio with new audio file

7,177

Short answer is yes. Yes you can.

See https://stackoverflow.com/questions/11779490/how-to-add-a-new-audio-not-mixing-into-a-video-using-ffmpeg

Specifically The section "To manually choose specific streams"

Once you combine the video (mp4) files in the order and length you want, you then combine the video (mp4) and audio (mp3) files together and use the -map option to choose the video stream and audio stream you want in the final output. This will then give you the video you want, and the audio from the mp3 file you have

EDIT

To answer your comment, you can use the concat command in ffmpeg to combine video's together

  1. Put this in a text file (we will call it list.txt) file 'path/to/file1.mp4' file 'path/to/file2.mp4' file 'path/to/file3.mp4'

  2. then ffmpeg -f concat -i list.txt -c copy output.mp4

Share:
7,177

Related videos on Youtube

mizzy
Author by

mizzy

Updated on September 18, 2022

Comments

  • mizzy
    mizzy almost 2 years

    I have a question about ffmpeg I have many shot mp4 video file and one mp3 audio (example: 1 hour long ) I want to combine random mp4 video file to one output file (length match mp3 length) and replace audio with that mp3 file to one output mp4 file.

  • mizzy
    mizzy almost 8 years
    Tks whale guy :P and a question combine random mp4 sir
  • mizzy
    mizzy almost 8 years
    and i have another little question :how to cut out middle of a video use ffmpeg Sir Whale :P