Today on the ELAR blog, we are sharing a post from ELDP grantee, Nick Williams on combining .mov files with FFmpeg (for Mac users). Nick works in Indonesia researching Kula, an endangered non-Austronesian language spoken in the eastern highlands of Alor.
Video version: https://youtu.be/c1YWg-5LCYw
I am currently working as a postdoc on a project focused on video documentation of multilingualism and everyday interaction in the northwest Amazon, focusing on two East Tukano languages, Wa’ikhana and Kótiria.
After just the first field trip this past July, we have over 500gb of video data to process. We are recording with two cameras, a Panasonic HC V770k (https://goo.gl/ukntYY) and a Zoom Q8 (https://goo.gl/6a3Bbh). The video files coming off the Panasonic are .MTS while the ones from the Zoom are .MOV, both with h.264 encoding.
For the Panasonic files, we can simply convert them to .mp4 with Handbrake, extract the audio with Audacity, and then use the resulting .mp4 and .wav for our bundles which we’ll pair with metadata files for archiving (we will later make selections from these raw video files to transcribe, translate, and further annotate).
The Zoom Q8, however, splits up recordings into 3.69GB chunks (or smaller). According to some sources, this is due to a maximum file size limit on .mov files. The settings we have the camera set to results in 18 minute 45 second chunks, which we then have to re-combine somehow. Previously, we were using either Movie Maker or Final Cut to do this. However, exporting the resulting re-combined video from these programs takes a long time. As far as I can tell, this is because they are re-encoding the videos during export. So we needed a way to combine (or ‘mux’) the files together without re-encoding. We had tried tsMuxeR, a free tool to do just that, but it fails to recognize .mov files. In comes FFmpeg!
FFmpeg is easy to use, but it doesn’t look like it at first. The website is a bit confusing and if you are not very tech savvy, it can be overwhelming. I had even downloaded and tried to install the program in the past and failed to figure out how to actually do anything with it. With the amount of data we have to deal with, though, it was becoming extremely tedious and slowing my system down too much to continue using Final Cut for this simple task. So I decided to spend some more time on it and finally figured out a simple solution, no small thanks to various other forums and YouTube tutorials.
Here I’m going to report on what I figured out and the workflow I have now for combining these .mov files into one larger file. Note, these re-combined files do still need to be converted to .mp4 before we can work with them further. I’m going to include both instructions on how to install FFmpeg and how to concatenate files with FFmpeg once it is installed. These instructions are for Mac users, but I’m relatively certain that things aren’t much different on a PC.
How to install FFmpeg
1. Install homebrew – go to brew.sh, copy code in first screen, paste the code in terminal, hit enter)
2. Install ffmpeg – just type the following into the terminal after brew has installed and hit enter: brew install ffmpeg
These were helpful when I was figuring this out myself:
https://goo.gl/B7e2p1 (simple instructions for installing FFmpeg)
https://goo.gl/mVqp4G (short youtube tutorial on installing FFmpeg)
How to combine video files
1. In terminal, navigate to the folder where your videos to be combined are located. On a mac, this is as easy as typing cd (‘change directory’) and then dragging the folder into the terminal window. Terminal will provide the path and you just hit enter. You can also type out the path manually, but sometimes this is hard if there are spaces or other special characters in your folder names.
2. Create a plain text file in textedit and save it to the same folder. Call it something simple like ‘mylist.txt’
3. In the text file, type: file ‘your-filename-here.mov’ for each file you wish to combine
For example, one of my text files looks like this:
file ‘gvc_20170802_dff-aff_02 (1).MOV’
file ‘gvc_20170802_dff-aff_02 (2).MOV’
4. Make sure your text file is plain text (easy on a mac, in textedit just go to ‘format’ and then click on ‘make plain text’). Also, make sure you put single quotes around the file name and that they are true plain single quotes ‘ , not an apostrophe ’. On my system, the single quotes are automatically changed if automatic spelling or smart quotes under substitutions is turned on. You can also turn these off if you right click in the textedit file window.
5. Go back to terminal and type in the following and hit enter (making sure you are in the right directory (i.e. folder) first):
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
*notes: the mylist.txt will be whatever you named your text file. The ‘output’ should be whatever you want the resulting file to be called, for example output.mov — it must have the extension.
6. Hit enter and FFmpeg should start concatenating your files. It should be quick, under a minute for a couple 10-20 minute files but not much longer for even for up to an hours worth of video or more. The resulting file will appear in the same folder as the originals and the text file.
In the end, you will get an output file with the name you defined and with extension .MOV in the same folder you created previously. This can be converted as necessary.
This content is by Nick Williams and originally appeared here.