10 ms·
FFmpeg is hands down one of the most powerful and feature-packed tools I've used out there.[0] The associated complexity is also daunting, but thankfully there'
by cooper12 6y ago
FFmpeg is hands down one of the most powerful and feature-packed tools I've used out there.[0] The associated complexity is also daunting, but thankfully there's a lot of documentation out there and it reflects the low level nuances of audiovisual formats.
I highly recommend anyone struggling to utilize it to write wrapper scripts around it so you only need to figure out things once. Here are some things I've done with it by that approach:
* Extracting any embedded subtitle files from MKVs. Nice if I want to search them or make changes.
* Back when GIFs were more popular, I converted any that were over 3MB to video to save space. If the output wasn't small enough, it would do a second pass with different settings to get it more compact. Not needed that much these days.
* "Barcodes" for videos, that is, it takes every second converted to a vertical sliver and combined you get an overview of how the average color of the film changes through its duration.
* A tool for creating video excerpts that lets me specify a start time and end time in more flexible timestamp formatting, and other things like a simple parameter for the output width.[1] It also allowed specifying a target filesize and did the math so the right bitrate would be chosen. I even include metadata so I know which original file it was made from and the parameters specified.
* Thumbnail previews. A lot of file sharing sites will include a file that includes some timestamped screenshots in a grid with encoding information at the top. This is good for movies so you see a high-level overview. The best part about doing this myself is that I could make it highly configurable, like choosing exactly how many images I want, the interval, whether I want timestamps, etc.
Note, for some of these, I also needed ImageMagick.
Also, when compiled with the right flags and libraries, FFmpeg has some really neat features: things like embedding subtitles, stabilizing video, hiding logos, etc. I recommend looking into the filters.
Thank you for all the manpower that goes into the project!
[0]: Two other ones that are also powerful are ImageMagick and Pandoc.
[1]: I initially wrote this in Bash, but later converted the code to Python to better handle command line arguments and allow things like using config files.