Hacker News new | ask | show | jobs
by Everlag 2056 days ago
If you want to do fun things with ffmpeg as a cli, most roads end at filter_complex[0]. You can get some truly impressive results at the cost of maintaining really intricate commands. There's also added value when onboarding a new teammate and seeing their eyes open when they find some of the commands you maintain...

Once you grok filter_complex, it becomes a lot easier to understand how people get very complex results out of ffmpeg.

Of less renown but worthy of a mention is the tee[1] muxer. It lets you take the same resulting input and pass it to different destinations. Incredibly handy, ie, for outputting DASH, HLS, and a regular ol mp4 from the same command WITHOUT having to redo the scaling or anything else that was in the filter_complex.

[0] https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1

[1] https://ffmpeg.org/ffmpeg-formats.html#Examples-12 (links to examples which is where you should start, scroll up to see docs)

3 comments

As "intricate" as some -filter_complex commands may be, it's still readable. Spending 2 hours reading and testing out commands should be all you need to master it.

I've been using many CLI tools for all kind of purpose and I think it cannot be stressed how well design the whole ffmpeg program is. I even made a whole music video montage out of it.

the thing that took a bit of time to keep from getting confused is audio mapping. streams are indexed from 0 while channels are indexed from 1. knowing when something needs the stream index vs the channel index gets weird until that one day it finally clicks. i also argue with its choices of channel layout names[0]. a lack of 5.1+2.0 to be labeled similar to L,R,C,LFE,Ls,Rs+Lt,Rt. instead, it wants to call it some 7.1 monstrosity. also, industry standard for 5.1 is L,R,C,LFE,Ls,Rs while FFMPEG calls it FL,FR,FC,LFE,BL,BR. They also forgo Lt/Rt for DL/DR. Maybe I'm too video centric, and these make more sense to an audio centric person???

[0]https://trac.ffmpeg.org/wiki/AudioChannelManipulation#Listch...

I did some work on making CTF-style challenge videos using filter_complex to try to get folks to play around with using ffmpeg filters in scripts. I barely scratched the surface but it ended up being a lot of fun.
I'd be very interested in doing a filter_complex CTF challenge. Are you willing to share what you worked on?
It's specific to an event that passed and won't do you much good, but like I said I barely started.

I've had the idea to turn it into something bigger, but I lack the time.

Totally understand but really appreciate the idea!
Where do you work that complex ffmpeg flows are part of the modus operandi?
From profile

> Engineer at Cloudflare doing video things.