Author Topic: Join Separate Video Files Into One Complete Video  (Read 1270 times)

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Join Separate Video Files Into One Complete Video
« on: May 14, 2010, 01:36:58 AM »
Lets say you have a complete video but it's divided into a bunch of segments or chapters and you'd like to join them into one complete file here is a great trick to know.

Open a terminal console and cd to the folder where the video files are. Example:
cd /home/user/Videos

Next you want to use the cat command. Pay attention to the order of the files because this will determine the sequence of the final file. Example:
cat file01.avi file02.avi file03.avi file04.avi > filename.avi

Now if they happen to be MPG files you are all done but if they are AVI files there is one more step. You must use mencoder to rebuild the index. Example:
mencoder -forceidx -oac copy -ovc copy filename.avi -o finalfile.avi

That's it. 1-2-3. This will only join files it has no effect on quality.

Cheers
« Last Edit: July 09, 2010, 08:58:42 PM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Online pags

  • Hero Member
  • *****
  • Posts: 2519
  • Keep it clean.
Re: Join Separate Video Files Into One Complete Video
« Reply #1 on: May 14, 2010, 12:28:39 PM »
I'll confirm that works.

I used it since way back to combine the VOB files from a DVD onto my kid's computer(s), so they could watch the movie without touching the DVD player (back when Shrek 2 was new on DVD):

Code: [Select]
cat FILE1.VOB FILE2.VOB ...etc ... FILEn.VOB > shrek2.mpg
(Note, file names are kind of made up from memory, not actual)

It was a big file (~7 Gb), but it played flawlessly on a crappy celeron full-screen (1280x1024) with mplayer... ;D

Offline exwintech

  • Hero Member
  • *****
  • Posts: 4340
  • 80% SandBox Rating Only
Re: Join Separate Video Files Into One Complete Video
« Reply #2 on: May 14, 2010, 02:54:02 PM »
4evergr8ful - For those not familiar with doing Video from Command-Line, they can do that with Avidemux.

> The easiest way to do that, is to put the clips to be joined in one directory - in /home or on a Desktop.

> Open Avidemux and if desired "pre-test" the clips by dropping them separately into the window. The Blue "i" button will open a list in which format, frame-size, type of Audio, can be checked. Those must be the same in each clip for joining to work properly.

> Once checked, open Clip-1 in Avidemux, go to File > Append, and browse to Clip-2, and click OK. Continue to add Clip-3, etc, to the new larger video, then Save that under a new name.

> The new Video will play as-is, but can be improved. Open it in Avidemux, and do a 2-Pass conversion to Xvid4 (or MPEG4 if recipients use Windows) - and can use Filters to Sharpen (apply VERY gently) - improve Colour, Denoise, etc. Using 2-Pass (Avidemux analyses and maps the content on the First Pass) - will improve the Audio sync across the previous-clip sections of the new Video.

> This method can be used to create a "preview" of a Video to be made from digital camera clips. Avidemux handles VGA or HD video in the H264/MOV format used by newer cameras, very well.

> Avidemux will convert downloads or camera clips to compliant *.mpeg(2) files, which can be used in DVD-Styler or Kdenlive to create compliant DVDs with Menus, etc, to play in TV-Players.

> Avidemux can convert VOBs back to *.mpeg(2) files, or Xvid4, which can then have sections edited out and saved to re-use in projects for DVD-Styler or Kdenlive.

Regards, Dave.
Registered Linux User #412504          Trainee Linuxer, jg