Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: How to merge multiple .mp4 files

  1. #11
    Join Date
    Apr 2006
    Beans
    2,889

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by TheFu View Post
    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.
    - snip -
    All .mp4 files have identical codec settings

    Performed following steps;

    1)
    On Terminal
    $ sudo apt-get update -y
    $ sudo apt-get install -y mkvtoolnix
    $ which mkvmerge
    Code:
    /usr/bin/mkvmerge
    2)
    On same Terminal run;
    $ mkvmerge -o output.mkv file_1.mp4 + file_2.mp4 + file_3.mp4
    Code:
    mkvmerge v45.0.0 ('Heaven in Pennies') 64-bit
    Error: The file 'file_1.mp4' could not be opened for reading: open file error.
    Regards

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

    Re: How to merge multiple .mp4 files

    There are some clues found here ..

    https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2680

    and did you try the several options in link in post#7 ?

  3. #13
    Join Date
    Apr 2006
    Beans
    2,889

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by dragonfly41 View Post
    - snip -
    and did you try the several options in link in post#7 ?
    post#7 is similar to
    Code:
    Create a file files.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):
    of link;
    https://newbedev.com/how-to-merge-mu...deos-on-ubuntu

    I have tried that but fail. All 3 .mp4 files are in the same folder. On Terminal I ran ffmpeg command on the same folder.

  4. #14
    Join Date
    Apr 2006
    Beans
    2,889

    Re: How to merge multiple .mp4 files

    Further to my previous posting

    Following link can merge .mp4 files but the output .mp4 file without sound.

    How to merge many mp4 videos with FFMPEG in a few seconds
    https://www.dandandin.net/how-to-mer...a-few-seconds/

    On Terminal performed following steps:-
    $ cd to the folder where .mp4 files stored

    $ ls
    Code:
    file_1.mp4 file_2.mp4 file_3.mp4
    $ find *.mp4 | sed 's:\ :\ :g'| sed 's/^/file /' > list.txt

    $ ffmpeg -safe 0 -f concat -i list.txt -c copy video-merge.mp4

    $ ls
    Code:
    list.txt video-merge.mp4 file_1.mp4 file_2.mp4 file_3.mp4

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

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by satimis View Post
    Code:
    mkvmerge v45.0.0 ('Heaven in Pennies') 64-bit
    Error: The file 'file_1.mp4' could not be opened for reading: open file error.
    file_1.mp4 is corrupt or has a permissions problem.

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

    Re: How to merge multiple .mp4 files

    Perhaps, as a test, try concatenating several clones of a single "good" file.
    Repeat test with clones of the suspect file.

  7. #17
    Join Date
    Apr 2006
    Beans
    2,889

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by dragonfly41 View Post
    Perhaps, as a test, try concatenating several clones of a single "good" file.
    Repeat test with clones of the suspect file.
    I found out the cause of problem without sound. It is because file_1.mp4 without sound/audio, not corrupted. I tested those 3 .mp4 files separately running VLC. All of them work without problem.

    So the command lines on #14
    Code:
    $ find *.mp4 | sed 's:\ :\ :g'| sed 's/^/file /' > list.txt
    
    $ ffmpeg -safe 0 -f concat -i list.txt -c copy video-merge.mp4
    work in combination seamlessly.

    Would it be possible including file_1.mp4 and retaining audio of other 2 .mp4 files?

    Regards

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

    Re: How to merge multiple .mp4 files

    Quote Originally Posted by satimis View Post
    Would it be possible including file_1.mp4 and retaining audio of other 2 .mp4 files?
    As already said, either the codecs used are 100%, exactly, the same with all settings, resolutions, tracks matching
    or
    transcode all of them.

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

    Re: How to merge multiple .mp4 files


  10. #20
    Join Date
    Apr 2014
    Beans
    806

    Re: How to merge multiple .mp4 files

    The main issue is the mp4. Run them through Handbrake to get mkv's. Then it's easy as linux works with open formats easily. mkvtoolnix or mkvmerge will work just fine then. If you want to go back to mp4 then go for it.
    Last edited by Tadaen_Sylvermane; August 29th, 2021 at 04:14 PM.

Page 2 of 3 FirstFirst 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
  •