Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: How to merge multiple .mp4 files

  1. #1
    Join Date
    Apr 2006
    Beans
    2,885

    How to merge multiple .mp4 files

    Hi all,

    Please advise how to merge/concatenate multiple .mp4 files running command lines.

    I found following link;
    How to merge multiple (more than two) videos on Ubuntu?
    https://newbedev.com/how-to-merge-mu...deos-on-ubuntu

    You can do it using ffmpeg:
    Code:
    ffmpeg -i concat:"input1.mp4|input2.mp4" output.mp4
    It didn't work for me, input2.mp4 not added. Both .mp4 files are in the same folder.

    Regards

  2. #2
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How to merge multiple .mp4 files

    Use OpenShot GUI ?
    Last edited by dragonfly41; August 28th, 2021 at 01:29 PM. Reason: added url

  3. #3
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,442

    Re: How to merge multiple .mp4 files

    I can recommend kdenlive to edit and splice the files. However, when all else fails, you can try using ordinary cat to concatenate the files. This will result in a fault at the join, but usually, a video player will skip the errors and keep going.

  4. #4
    Join Date
    Apr 2006
    Beans
    2,885

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by dragonfly41 View Post
    Hi,

    Thanks for your advice.

    In the past I usually did it in this way including editing the video. I'm now looking for a command line solution.

    Regards

  5. #5
    Join Date
    Apr 2008
    Beans
    71

    Re: How to merge multiple .mp4 files

    Try:

    Code:
    ffmpeg -i "concat:input1.mp4|input2.mp4" -c copy output.mp4
    Note the position of the quotation marks.

    Official documentation:

    https://trac.ffmpeg.org/wiki/Concatenate

  6. #6
    Join Date
    Apr 2006
    Beans
    2,885

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by HermanAB View Post
    I can recommend kdenlive to edit and splice the files. However, when all else fails, you can try using ordinary cat to concatenate the files. This will result in a fault at the join, but usually, a video player will skip the errors and keep going.
    Hi.

    $ cat file1.mp4 file2.mp4 file3.mp4 > output.mp4

    It didn't work. I suppose it works on .txt files

    Regards

  7. #7
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How to merge multiple .mp4 files


  8. #8
    Join Date
    Apr 2006
    Beans
    2,885

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by philhughes View Post
    Try:

    Code:
    ffmpeg -i "concat:input1.mp4|input2.mp4" -c copy output.mp4
    Note the position of the quotation marks.
    Still failed. input2.mp4 not added

  9. #9
    Join Date
    Apr 2008
    Beans
    71

    Re: How to merge multiple .mp4 files

    The documentation does say it only works for certain streams, so may be mp4 is not one of them. You will have to try one of the other methods described.

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to merge multiple .mp4 files

    If the input files all have identical codec settings, then you can merge them using mkvmerge.
    Code:
    $ mkvmerge -o output.mkv         file1.mp4 + file2.mp4 + file3.mp4 + file4.mp4
    This will get all the video, audio, srts, ass, subs, and other information from the files and append them perfect.

    If they do not have the same codec settings (or have different resolutions, track ordering, etc), the only answer is to transcode them each into a single output. I'd do that with

    Code:
    $ cat files*mp4 | ffmpeg -i -   {some settings}   output.mp4

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •