The Problem
It all started when Premiere Pro started glitching out. When I was trying to import a simple image sequence, like I’d done a thousand times before, it only imported the first 25% of the frames. Everything else was missing. There was no inconsistency in the file naming convention. Everything was sequential. There were no missing frames. Premiere is just glitchy.
The Workaround
I came up with an idea for a workaround. Instead of importing an image sequence, what if I just concatenated all those image files into a ProRes MOV? That way I can just drop the whole thing into Premiere with no problems. I tried to get Adobe Media Encoder to do that, but it wasn’t the most intuitive experience of my life. Every time I tried to import a sequence, it only gave me the first frame, and ended up rendering frame 1 over the entire length of the sequence. Solution? FFMPEG.
What is FFMPEG?
Ffmpeg is a command line application that allows you to manipulate images, video, and audio. It does take some getting used to, but once you get the hang of it, it is WELL worth the time you put in to learn the basics of the application. I do want to emphasize just the basics, as ffmpeg and all of its options are pretty vast.
As a 3D artist and animator, I deal a lot with image sequences. Unfortunately Premiere and other NLEs can sometimes glitch out and not give you what you want when you import a sequence. FFMPEG allows you to concatenate a series of images and encode those frames into a single video file with a codec and container of your choosing.
If you have other open source video applications like VLC player or Handbrake, you might already have ffmpeg installed on your system. You can check by running this in the terminal:
ffmpeg -version
If you don’t have it, you can get it easily by running:
sudo apt install ffmpeg
Now that you’ve got ffmpeg, you can do TONS of stuff with it. There’s a giant list of commands or you can check out the man page:
man ffmpeg
You can convert video files as simply as:
ffmpeg -i input.mp4 output.avi
The Tricks
ffmpeg is used to initialize the program, -i is used to set your input file(s), and you can add more options like scale, fps, codecs, bit rates, and more with a long list of options available. For my purposes, I usually want to take a folder full of .png files and convert them into an MOV file for editing. For that, I can just ‘cd’ into the folder containing all my .png frames, and run something like:
ffmpeg -f image2 -pattern_type glob -framerate 23.976 -i cyclesShotFour_*.png shotFour.mov
Let’s break that down. The -f tack lets you indicate a format. To see all available formats, just run:
ffmpeg -formats
It’s worth noting that formats are different than codecs. To view the massive list of codecs available in ffmpeg, just run:
ffmpeg -codecs
Easy, right? Next we told ffmpeg to grab all the .png files in the current working directory matching the pattern we defined. In my example, all my files were named cyclesShotFour_0001.png, cyclesShotFour_0002.png, etc. There’s quite a few ways to define a pattern, and you can learn more here. Once ffmpeg has all your images defined, all you need to set your framerate and other stuff you may want and you’re good to go! Tack -framerate defines your framerate. At the end, just type the name of your output file. That’s it!
Some of the other options that wasn’t mentioned in the above example, that I use quite frequently is setting the bitrate and the codec. The tacks for those options are -b:v (bitrate for video) -b:a (bitrate for audio) -c:v (codec for video) -c:a (codec for audio). So let’s say I want to encode a bunch of .jpg files into a Apple ProRes MOV file. Clearly, the output won’t have audio, so we don’t have to specify any audio options.
ffmpeg -f image2 -c:v prores -framerate 23.976 -b:v 6000k -pattern_type glob -i frame*.jpg output.mov
Anway, there are tons of different things you can do with ffmpeg, and it’s an absolutely amazing tool. It saved my butt just last week! Have fun and keep learning.