Tuesday, February 24, 2015

Toolbox: FFmpeg

This is an attempt at an idea I had to document the tools, software or otherwise, that I find indispensable. Tools can be used in many different ways and for different reasons so I'll try and keep these sort of abstract but provide enough links to explore further if you're so inclined.

It's not always the best solution for every situation, but I'll be darned if it can't handle just about ANY situation. To list it's abilities and format support is beyond the scope of this post but suffice it to say they are both... extensive. It's also free, open source, and runs on just about everything.

Some things I use FFmpeg regularly for: container swaps, trimming or extracting compressed video/audio without needing to re-encode, processing image sequences, auto cropping material to remove baked in padding, adding fade ins/outs to media, and so on. There's also a component FFprobe which is a great way of examining the stream properties of files and their metadata, and FFplay which is a playback app that can run the same parameters as the encoder, so you can preview things such as aspect width adjustments or other filters before encoding them.

If you're familiar with scripting you can also use FFmpeg to do some really neat stuff. Batch processing folders, compiling metadata on a group of media, playing two versions of a file back side by side in sync for comparison, it even has a streaming media sever component (ffserver). If you want to get fancy you can even use something like Pashua to make a little GUI for your FFmpeg recipes, essentially creating droplets for different scenarios.

If you're on a Mac and looking to get FFmpeg your two best options are:

Someone, who may or may not be the real MVP, offers a precompiled mac binary that you can quickly download to give FFmpeg powers to any machine you happen to be on.
Install it through Homebrew, which gives you the ability to build with the particular options you might want like Ogg Vorbis support, and is much easier to keep up to date.

(Windows precompiled here, hough I haven't tested these personally. If you're on Linux you don't need me telling you what to do.)

In terms of figuring out syntax and functionality, the best resource for me has been the official documentation which seems to have a little more in depth info/examples than the man pages or filter help strings. It definitely has a steep learning curve at first. It helps to have a specific goal in mind while trying things out, otherwise it can be a bit overwhelming.

On that note, I recently became aware of a project called iFFmpeg which is GUI wrapper that asks you to BYOB (bring your own binary). I've tested with both the precompiled that I've linked above and my version from homebrew and both seem to work fine.  The app is 20 bucks and is just a fancy set of clothes that doesn't offer any additional functionality to the free command line app. That being said, it is pretty slick and can make things a lot easier if you're not a command line user.

It also has the potential to be a great learning tool as you can setup all your parameters and when you hit OK it actually outputs the full command line syntax of your choices (since it's just interacting with the FFmpeg binary) which can be a great way to jumpstart your understanding of what flags/switches do what. There's nothing wrong with using this app as is, but you lose out on some of the more advanced capabilities that come about as integrating FFmpeg with your own scripts/apps.

No comments:

Post a Comment