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

order of ExtraArgs

Open thaeger71 opened this issue 8 years ago • 7 comments

Hi there, I'am working on a project where I have to decode, encode and join several raw audio files.

For example:

file1.pcma file2.pcma

with a command like this:

ffmpeg.exe  -filter_complex "[1:a]adelay=4000[a1];[0:a][a1]amix=inputs=2:duration=longest" -f alaw -ar 8000 -ac 1 -i file1.pcma -f alaw -ar 8000 -ac 1 -i file2.pcma -ar 8000 -ac 1 out.wav

For this it's important to have args in the right order.

I tried to get something like this with ffmpeg-cli-wrapper, because it's a nice peace of software and covers all the event and threading stuff. I tried it with the following command:

FFmpeg ffmpeg = new FFmpeg("./src/main/resources/ffmpeg/ffmpeg.exe");
FFmpegBuilder builder = new FFmpegBuilder()
	.addExtraArgs("-filter_complex \"[1:a]adelay=4000[a1];[0:a][a1]amix=inputs=2:duration=longest\"")
	.setInput("./file1.pcma").setFormat("alaw").addExtraArgs("-ar 8000 -ac 1")
	.addInput("./file2.pcma").setFormat("alaw").addExtraArgs("-ar 8000 -ac 1")
	.addOutput("./output.wav").addExtraArgs("-ar 8000 -ac 1").done();

what it has produced was:

./src/main/resources/ffmpeg/ffmpeg.exe -y -v error -f alaw -filter_complex "[1:a]adelay=4000[a1];[0:a][a1]amix=inputs=2:duration=longest" -ar 8000 -ac 1 -ar 8000 -ac 1 -i ./file1.pcma -i ./file2.pcma -ar 8000 -ac 1 ./output.wav

As you can see the order is not right. The format argument has only appliend once and the other two extraargs doesn't belong to the right input because of the order.

thaeger71 avatar Jan 24 '17 07:01 thaeger71

For this, I need to refactor the project to support a FFmpegInputBuilder, so we can attach arguments to particular input streams. Right now, arguments are only attached to output streams.

bramp avatar May 13 '17 05:05 bramp

@bramp are you working on this? I see that it's affecting more people, so I could resume working on that builder.

igracia avatar May 19 '17 08:05 igracia

@igracia I am not working on this, I was hoping you would wrap it up :)

bramp avatar May 20 '17 21:05 bramp

Ok, I'll allocate some time to finish the implementation.

igracia avatar May 21 '17 10:05 igracia

If this issue is still relevant, you can use my command line ffmpeg wrapper - Jaffree

kokorin avatar Jun 17 '17 08:06 kokorin

@igracia Hello. I was planing to work on this for issue #156 to get support for input devices. Are you currently working on it?

Omar-Riaz avatar Aug 06 '18 08:08 Omar-Riaz

@Omar-Riaz sorry, never got back to this. I don't think I will resume my work anytime soon, so please do proceed with that.

igracia avatar Dec 27 '18 13:12 igracia