Tuesday, August 16, 2011

Joining Video File Segments Without Re-encoding

Have you ever downloaded a video in multiple segments or converted a double sided or dual-disc DVD, which leaves you with two video files? Ever wondered if you could simply join these files together for seamless playback?

If you're still reading, then I assume you do. Well, same here and I wanted a tool to do the job that didn't require a degree in video production techniques and of course, if it was free, then all the better.

After much searching and experimentation, I found a few free utilities available to do just that. There are also loads that either don't work as they say they will, are just too complicated or insist on re-encoding the video, which almost always results in some loss in quality.

There are a few provisos to attaining that no re-encoding goal in that all segments to be joined must be encoded in the same way, have the same bit-rate, same resolution, etc.

So, here are my recommendations for joining/concatenating the more common video file types…

Hint: before joining files, make sure they're all in the same folder and that each file is numbered in joining sequence. e.g. video1.avi, video2.avi, etc.

ASF, WMV

For ASF and WMV files, there's AsfBinWin. a Windows utility for cutting out fragments, joining, editing and repairing ASF files. It can operate on any ASF, WMA and WMV files and it does it all without re-encoding.

Joining ASF or WMV files with it is easy…
  1. Use the Select files from: … button on the right to locate the folder containing the desired file segments.
  2. Highlight the desired files in the order you want to join them in and click on the ←←← button to move the files to the List of input files: pane on the left. The program will check all is okay and number the files in colour-coded order.
  3. Under Destination: select a destination and file name for the joined file. The program will default to out.asf.
  4. Click on the Cut / Copy / Join button.
AVI

For AVI files, there's VirtualDub, a video capture/processing utility for Windows. Joining video segments isn't really what this program was designed for but it does it so simply and, with the right settings, without re-encoding…
  1. Select the Direct stream copy option from the Video menu.
  2. Select the Direct stream copy option from the Audio menu.
  3. Use the Open video file… option from the File menu to open the first file in the sequence.
  4. Use the Append AVI segment… option from the File menu to add additional segments in order. If the program warns you that the audio bit-rates don't match, then use the Full processing mode option from the Audio menu. It'll take a wee bit longer to process but not that much.
  5. Use the Save as AVI… option from the File menu to choose a file name and destination and to begin the joining process.
If you're running Mac OS X, then try AVITools. The interface isn't exactly intuitive and the unregistered version is a bit annoying to use but it will join identically encoded files. If it works for you, then paying the really cheap registration would be worth it.
    FLV

    For joining FLV (Flash Video) you can try FLV Joiner or SUPER but to achieve lossless joining, the video file formats must be identical.

    MKV

    Get yourself MKVToolnix, a set of tools to create, alter and inspect Matroska files under Linux, Unix and Windows and it can also handle MP4 files but the output will be saved as MKV.
    1. Open the first file in the sequence.
    2. Click on the Append button to add the next file. Repeat until all segments have been added.
    3. Click on the Mux Now button.
    4. Save the file.
    Regardless of the site's statement that the Mac OS X version of MKVToolnix requires MacPorts, there's a native version for Mac OS X 10.5 and above available from http://jonthn.free.fr/MKVtoolnix/

    Another option is MKVTools for Mac OS X. Again, like AVITools, the interface is a bit confusing but it'll do the job. It's worth noting that, at the time of writing, the developer was working on a new version and only the old one is available for download.
      MP4, M4V

      MP4Box for Windows should be able to do the trick for MP4 and M4V files here but it's a command-line tool (life's too short) but, even with attempts using both popular GUI front-ends My MP4BoxGUI and Yamb, I just couldn't get it to work with any of the video files I had.

      However, I did have some success with MP4Tools, a sister application to AVITools and MKVTools for Mac OS X.

      MOV

      If you have a QuickTime Pro registration, then you can easily join MOV files using QuickTime Player
      1. Open the first file in the sequence.
      2. Move the insertion point to the end of the movie.
      3. Open the next file in the sequence.
      4. Select the entire movie using the Select All option from the Edit menu.
      5. Select the Copy option from the Edit menu.
      6. Activate the original/first file movie window and select the Paste option from the Edit menu.
      7. If you have more segments to add, then repeat steps 3 to 6 until done.
      8. Select the Save As… option from the File menu and save the new, concatenated movie.
      You can use this method for any format that Quicktime supports but it'll always want to save as a .mov file.

      It should be noted that SUPER claims to be able to join identically encoded files of any input format it supports so it'd be worth trying on any of the above formats.

      PS Just to be clear, I've tried AoA Video Joiner, Yamb/MP4Box, Avidemux, All Free Video Joiner and a few others but all of them failed in the task for various reasons.

      PPS Some very useful sources of information are the guides and tutorials from VideoHelp.com, AfterDawn, and Doom9.net.

      I'd always be happy to hear of any other similar tools or better methods of joining video files.