How do I merge two *.avi files into one

I have two *.avi files:

sequence1.avi
sequence2.avi

How do I merge these two files using a command-line or GUI?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

There’s a dedicated tool to do this, avimerge:

avimerge -o cd.avi -i cd1.avi cd2.avi

If not installed, install transcode: Avimerge is part of transcode package:
https://manpages.debian.org/jessie/transcode/avimerge.1.en.html
http://manpages.ubuntu.com/manpages/bionic/man1/avimerge.1.html

Method 2

Easy with mencoder (shipped with mplayer in Arch Linux):

$ mencoder -oac copy -ovc copy video1.avi video2.avi -o final.avi

Method 3

Avidemux can paste two videos together, at least if they have the same resolution and a few other constraints. Use “Append” from the “File” menu.

Method 4

You can merge avi files with avimerge from Transcode package:

avimerge -i file1.avi file2.avi -o output.avi

I know that it isn’t GUI tool, but to have GUI you could use that script:

#!/bin/bash
file1=`kdialog --getopenfilename ~/ *.avi`
file2=`kdialog --getopenfilename ~/ *.avi`
output=`kdialog --getsavefilename ~/ *.avi`
avimerge -i $file1 $file2 -o $output

It uses kdialog so it’s for KDE users, GNOME users should modify it to use Zenity…

Method 5

What about using ffmpeg concat like that:

ffmpeg -f concat -i 
<(for f in $PWD/*.avi;do echo "file '$f'";done) 
-c copy output.avi

If you get an error Unsafe file name add -safe 0 between concat and -i.

Method 6

If you’re not wedded to the AVI container format as output, you can get easy lossless joining of AVI files from MKVtoolnix GUI. https://forums.plex.tv/t/howto-joining-multi-part-movies-files-with-mkvtoolnix-gui/113211 (The instructions in this link boil down to: add the first AVI file, right click > append > choose second file, then click “start muxing”).

This also works for subtitles, mp4 files, etc. It also has the advantage of an output file that is more reliable to play and stream on modern players.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x