ffmpeg-cli-wrapper icon indicating copy to clipboard operation
ffmpeg-cli-wrapper copied to clipboard

setComplexVideoFilter with unexpected results with filtergraph

Open igracia opened this issue 8 years ago • 6 comments
trafficstars

I'm using the setComplexVideoFilter to add an adelay/amix filter, to merge audio and video tracks that have different lengths, into a single file. I have ffmpeg 3.2 installed in OS X.

The actual command that works is ffmpeg -y -v error -i video.trk -i audio.trk -filter_complex "[1:0]adelay=10000|10000[t1];[t1]amix=inputs=1" -c:v copy out.webm. To have the library generating the same command, I had to add escaped quotes to the string, producing the following line outputBuilder.setComplexVideoFilter("\"[1:0]adelay=10000|10000[t1];[t1]amix=inputs=1\"");. This yields the following result.

/usr/local/bin/ffmpeg -y -v error -i video.trk -i audio.trk -filter_complex "[1:0]adelay=10000|10000[t1];[t1]amix=inputs=1" -c:v copy out.webm
Truncating packet of size 21863284 to 2742585
Truncating packet of size 21863284 to 181769
[AVFilterGraph @ 0x7faa89416fe0] No such filter: '"'
Error initializing complex filters.
Invalid argument

Issuing the following line outputBuilder.setComplexVideoFilter("[1:0]adelay=10000|10000[t1];[t1]amix=inputs=1"); produces an expected error, as the complex filter should go between quotes

/usr/local/bin/ffmpeg -y -v error -i video.trk -i audio.trk -filter_complex [1:0]adelay=10000|10000[t1];[t1]amix=inputs=1 -c:v copy out.webm
Truncating packet of size 21863284 to 2742585
Truncating packet of size 21863284 to 181769
Filter amix has an unconnected output

which is expected, as it is the same output that you get when running from command line.

Not sure if there's anything we can do here, and is a problem from the ProcessBuilder itself. Any ideas?

igracia avatar Dec 08 '16 10:12 igracia