Show HN: Typed-FFmpeg 3.0–Typed Interface to FFmpeg and Visual Filter Editor
I built typed-ffmpeg, a Python package that lets you build FFmpeg filter graphs with full type safety, autocomplete, and validation. It’s inspired by ffmpeg-python, but addresses some long-standing issues like lack of IDE support and fragile CLI strings.
What’s New in v3.0: • Source filter support (e.g. color, testsrc, etc.) • Input stream selection (e.g. [0:a], [1:v]) • A new interactive playground where you can: • Build filter graphs visually • Generate both FFmpeg CLI and typed Python code • Paste existing FFmpeg commands and reverse-parse them into graphs
Playground link: https://livingbio.github.io/typed-ffmpeg-playground/ (It’s open source and runs fully in-browser.)
The internal core also supports converting CLI → graph → typed Python code. This is useful for building educational tools, FFmpeg IDEs, or visual editors.
I’d love feedback, bug reports, or ideas for next steps. If you’ve ever struggled with FFmpeg’s CLI or tried to teach it, this might help.
Thanks! — David (maintainer)
For example, I've done experiments running every single program in /usr/bin with --help and -h. The number of failures to get any useful help are a huge percentage. (The normalization of said percentage naturally is idiosyncratic to the exact system I ran that on).
Anyway, adding types to a complex one like ffmpeg may help more people realize this as well as offering practical benefits. So, great job!
Also, I should have been more clear that while the CL parser toolkits are basically CfLangs/PLangs (maybe without loops, etc.), every command doing its own hand-rolled argv parser is basically its own totally unique language, probably doing only a subset of the 6..10 common conventions. It's probably not a great language, just something serviceable.
Basically, getopt wasn't good enough or easy enough or taught well enough, or done "soon enough". By the time it had come along, even within Bell Labs, they had probably grandfathered in old commands like `dd` and `find` (because "hey, I have a whopping 5 scripts that work with the old way!") with all their many & varied bespoke syntaxes.
Anyway, sadly, we only get our one try at "history" and many things are "sticky".
If you want to try this at home, you should maybe either have GOOD BACKUPS HANDY OR DO IT WITHIN A VIRTUAL MACHINE/CONTAINER (EDIT: and almost certainly NOT AS SUPERUSER) also be ready to kill processes that are hanging waiting on stdin or somesuch. You're likely to have a least a few.
WITH THIS WARNING BEING GIVEN, you could just:
Of course, you could try /bin if that's any different (for me it's a symlink to the same dir as /usr/bin these days). You could also do single dash help.If you want to accumulate some stats yourself, then you'll probably want to postprocess those output files.. So, you might also adapt the embedded echos to make it easy for whatever you like to do for that. Or, alternatively, you could re-direct each output to a per-command file with a little ${cmd##} massaging.
EDIT: and if you're asking what the CL syntax conflict was, well, I only meant to refer to "How to get any help at all - command with no args, with -h, -help, --help, -?, etc." as that is kind of the "very first question" on a user's mind. There are other syntactic conflicts (combining bool flags, option-value separation, unique prefix matching, etc., etc.).
- It doesn't appear to have any way of specifying filters that do not have inputs, such as "color"
- There is no way to provide flags to Popen, e.g. to specify subprocess.CREATE_NO_WINDOW to avoid CMD windows popping up in a GUI app on Windows. This isn't a big deal for running ffmpeg itself, because you can just ffmpeg.compile() then run it manually, but that can't be done for ffprobe with ffmpeg.probe().
Edit: OK, figured out the source filter thing, ffmpeg.sources.color. Is there a way to use arbitrary source filters, like vfilter/afilter can do for regular ones?
No comments yet
[1] https://www.vapoursynth.com/
Changes are on this branch for the curious:
https://github.com/matt-hensley/typed-ffmpeg/tree/feature/mu...