eloquent-ffmpeg icon indicating copy to clipboard operation
eloquent-ffmpeg copied to clipboard

Support Complex Filter Graphs

Open federicocarboni opened this issue 5 years ago • 5 comments

Description

Simplify the use of the -filter_complex option.

Related Issues

#4

federicocarboni avatar Oct 22 '20 17:10 federicocarboni

Filter escaping is currently broken in the library https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1

federicocarboni avatar Feb 04 '21 07:02 federicocarboni

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 avatar Feb 24 '21 16:02 jallen

@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.

federicocarboni avatar Feb 24 '21 17:02 federicocarboni

The args on the output worked! Thanks again.

jallen avatar Feb 24 '21 17:02 jallen

I quite like fluent-ffmpeg's approach: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#complexfilterfilters-map-set-complex-filtergraph

laggingreflex avatar Mar 22 '22 17:03 laggingreflex