ffmpeg-cli-wrapper
ffmpeg-cli-wrapper copied to clipboard
FFmpegBuilder params order cause error
Describe the bug FFmpegBuilder some params order must add in -i option back
To Reproduce
File file = new File("cut1.png");
file.createNewFile();
FFmpegBuilder builder = new FFmpegBuilder()
.overrideOutputFiles(true)
.addOutput(file.getAbsolutePath()).done()
.addInput(probeResult).addExtraArgs("-vframes", "1");
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg);
executor.createJob(builder).run();
Expected behavior ffmpeg -y -v error -vframes 1 -i /Users/xx/ffmpeg/cut.mp4 /Users/xxx/ffmpeg/cut1.png Option vframes (set the number of video frames to output) cannot be applied to input url /Users/xxxx/ffmpeg/cut.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for input file /Users/xxx/ffmpeg/cut.mp4. Error opening input files: Invalid argument
right command order
ffmpeg -y -v error -i /Users/xx/ffmpeg/cut.mp4 -vframes 1 /Users/xxx/ffmpeg/cut1.png
Version (if applicable):
- OS: [e.g. Linux]
- Java Version [e.g. 8]
Additional context Add any other context about the problem here.
@dirklu @bramp Hi, If requirement is just need to add vframe then don't use add extra arg method. Below code produce the required command.
File file = new File("/home/hariom/Downloads/download.jpeg"); file.createNewFile(); FFprobe ffprobe = new FFprobe(); FFmpegProbeResult probeResult = ffprobe.probe("/home/hariom/Downloads/video.mp4"); FFmpegBuilder builder = new FFmpegBuilder() .overrideOutputFiles(true) .addOutput(file.getAbsolutePath()) .setFrames(1) .done() .addInput(probeResult);
actual : ffmpeg -y -v error -i /home/hariom/Downloads/video.mp4 -vframes 1 /home/hariom/Downloads/download.jpeg expected :ffmpeg -y -v error -i /home/hariom/Downloads/video.mp4 -vframes 1 /home/hariom/Downloads/download.jpeg