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

Support setting input arguments (such as format and bitrate)

Open weolopez opened this issue 9 years ago • 6 comments

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.

weolopez avatar Apr 25 '16 16:04 weolopez

I think #22 cover the -f part

davinkevin avatar May 21 '16 22:05 davinkevin

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.

bramp avatar Jun 05 '16 19:06 bramp

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 avatar Jun 05 '16 20:06 bramp

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

igracia avatar Nov 16 '16 18:11 igracia

I think the Itoffset should be an attribute of the input... which would be an object instead of a simple string.

davinkevin avatar Nov 16 '16 18:11 davinkevin

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

igracia avatar Nov 16 '16 18:11 igracia

Closed thanks to #339

Euklios avatar Aug 21 '24 12:08 Euklios