Friday, November 20, 2015

Concatenating Videos: Joining multiple videos without re-compressing

Today, I want to go over how to concatenate your videos. I am using a PC with windows 8.1, but FFMPEG also works with Linux and Mac. Only the last step is unique to windows.

To me, this really isn't as complicated as it sounds, but there are a lot of steps so this may not be for the faint of heart.

Also, from what I understand if you install FFMPEG the wrong way, it could lead to your computer to not load properly. The author of this article is not liable for anything that happens if you go this route.

Enough of the disclaimers! For the advanced user, it's an invaluable tool to have in your collection.

I want to thank and acknowledge Jim Watters, I stumbled upon his method in a Video-Stitch forum after searching for a better way to concatenate (I was using a paid program that could only do one at a time).

There are several ways to concatenate videos, but most of them only allow you to concatenate one video sequence at a time. The FFMPEG way, allows you to concatenate as many video sequences as you want, all at the same time. Plus it's FREE, so we highly recommend it!



In this video, I explain concatenating and show you my prefered method. 
To install the software and batch files needed, continue reading the blog.



Concatenation is a process where you join multiple videos without re-compressing (which degrades the quality). For 360 video this is especially important if you are filming with cameras like GoPro's, that have a 4 Gb limit due to FAT-32 file allocation.What happens if you go over that 4Gb limit is that your GoPro makes a new file. So if you have a situation where you need to film continuously for several hours, instead of ending up with 6 really long files, you'll end up with something like 24 different files, broken up into 4GB each, with the last one being a little smaller.

Before we get into it, Kolor just released Autopano Video Pro 2.3.0 beta, which has an importer that concatenates the files while importing. I will test this feature soon and let you know how it works, but even if it works like a charm, there are still many instances where being able to concatenate is a great tool. One example is if you have footage already shot that you need to concatenate, another is if you don't have AVP loaded on your computer when you first dump your footage and a third is, you can make a video, then add intro and credits without having to re-compress your video. In short, it's a great tool.


The first step is to download and install FFMPEG. This isn't as straightforward as it sounds, but there's a great article that gives step by step instructions here.


The only thing you need to do differently is to instead of putting the FFMPEG folder directly on you C drive, put them in C:\Program Files.

So if you were to dig into the directory it should look like this:
C:\Program Files\ffmpeg\bin\ffmpeg.exe


Once you've followed all of those steps, you can use the command line tool to do all sorts of compression and concatenating. To find out more about FFMPEG, go to their website. If you're not a coder, like the author of this blog, then the next step is especially helpful for you, but coders follow along too.



Jim Watters made a batch file that works really well, to use it follow these steps.

First, download his batch file,
dropbox.com/s/c8jc3d7a4y7ys1y/ConCatMovies.bat?dl=0

Then paste this file in your Send To folder. If you don't know how to get there, paste this into file explorer:
%APPDATA%\Microsoft\Windows\SendTo   

After you've done this last step, you can literally select the videos you want to concatenate, right click, send to, concat videos

FFMPEG will ask you to specify a name and your videos will automagically start concatenating, and you can do this with as many videos as your computer will handle.



To change the location of where your files go, find the ConCatMovies.bat file, right click, edit and where it says

"set "IMAGETEMP=c:\temp\"

just change c:/temp/ to wherever you want the files to go. I usually create a Concat folder on an external drive and change the destination, so it will look something like:
"set "IMAGETEMP=h:\concat\".

Also a good thing to note is when you are selecting the clips to concatenate, make sure select from last clip to first clip, for example with four clips named 1,2,3,4 that you want to join, you would select 4, then 3, then 2, then 1, or shift select 4 then go to 1.

The reason for this is what ever the last clip you select is, this will be the first clip. So if you were to select 1,2,3,4 instead, it would join them as 4,1,2,3 because 4 was the last thing you selected.

Always check the order in ffpeg before you start the process.







Look at the end of the file names, Ep1 should be first, but the order is incorrect. 
If selected in order from 1,2,3, ffmpeg will put 3 first, then 1,2... 
So always select backwards, 3,2,1 etc.



Thanks again to Jim Watters for this great way to concatenate.

I hope this article is helpful for you and if you get stuck anywhere, comment below and I'll try to guide you in the right direction. 

No comments:

Post a Comment