ffmpeg-cli-wrapper
ffmpeg-cli-wrapper copied to clipboard
Support setting input arguments (such as format and bitrate)
Format and AudioSampleRate needed in FFmpegBuilder.
ffmpeg -f s16le -ar 16000 -i input.pcm output.wav
It wont work with ffmpeg -i input.pcm -f s16le -ar 16000 output.wav
I added format and AudioSampleRate to get it to work but I don't think this is exactly how you have envisioned FFmpegBuilder and FFmpegOutputBuilder working. I don't mind fixing it and providing a pull request but just wanted to get an understanding of your vision.
I think #22 cover the -f part
Ah for my future reference. The issue here is wanting to force the input format and audio rate. Right now, we only allow the output formats to be set.
We can either add multiple methods on the FFmpegBuilder, or correct a new FFmpegInputBuilder.
In the mean time I've committed c72b279427587b1199829fe04435e2164c345da6 that allows you to specify extra input and output args, for when it's not directly supported.
For example:
List<String> args = new FFmpegBuilder()
.addExtraArgs("-f", "s16le", "-ar", "16000")
.setInput("input.pcm")
.addOutput("output.wav")
.done()
.build();
@bramp I've been trying to use this feature to add a different -itsoffset for each track, but so far haven't managed to get that working to provide different values for each track. The command is
ffmpeg -y -v error -itsoffset 10.157 -itsoffset 1.1 -i audio.trk -i video.trk out.webm
while the desired output is
ffmpeg -y -v error -itsoffset 10.157 -i audio.trk -itsoffset 1.1 -i video.trk out.webm
is there any other way to obtain the second command?
I think the Itoffset should be an attribute of the input... which would be an object instead of a simple string.
@davinkevin Yes, it should be an attribute for the input. Let me rephrase the question better, then. Is it possible to set arguments for each input separately? I guess the answer is no.
I've submitted PR #75, which should allow us to do precisely this. Please let me know if you find this approach feasible.
Closed thanks to #339