eloquent-ffmpeg
eloquent-ffmpeg copied to clipboard
Support Complex Filter Graphs
Description
Simplify the use of the -filter_complex option.
Related Issues
#4
Filter escaping is currently broken in the library https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1
This is such a great library. Thanks for putting it out there!
Is there are workaround to support -filter_complex right now?
I'm trying to overlay an image over a video.
@jallen You can still add custom arguments to the output like so
const cmd = ffmpeg();
cmd.input('video.mkv');
cmd.input('image.png');
// you can add extra options to the overlay filter, check ffmpeg's docs ;)
cmd.output('out.mkv').args('-filter_complex', 'overlay');
const proc = await cmd.spawn();
await proc.complete();
Currently, the library doesn't expose any fancy helpers for working with complex filters. The syntax that FFmpeg uses for complex filters can't be easily and meaningfully be represented by JavaScript values. Or at least, it's more difficult than with simple filters. The bare minimum would be exposing some escape functions to work with complex filters. I've even considered using template literals, but it would be a bit more complicated to implement and still not very easy to use. I'm taking a long time because I want to get it right.
If you have any idea or advice I'll appreciate it. Have a nice day.
The args on the output worked! Thanks again.
I quite like fluent-ffmpeg's approach: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#complexfilterfilters-map-set-complex-filtergraph