-
-
Notifications
You must be signed in to change notification settings - Fork 423
Add FFmpegInputBuilder to support per input options #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is mainly focused towards fixing EncodingOptions and making it easier to update in the future. |
I am inrested in this too. I currently use addExtraOptions to pass pass input options for decoding rawvideo, like videosize and pixel format. |
@AlexanderSchuetz97 Thank you for the feedback! |
For anyone interested, I created PR #339 for this feature. |
i forgot about giving you examples today. Will do so on monday hopefully. |
No problem, any form of help is appreciated |
These are the 2 Main occurrences of "addExtraArgs" for an Input in the code-base of my current Project. Also FYI, add an option to disable B frames please. (-bf 0) FFmpegBuilder builder = new FFmpegBuilder()
.addExtraArgs("-video_size", size.getWidth() +"x"+size.getHeight())
.addExtraArgs("-f", "rawvideo")
.addExtraArgs("-r", Fraction.getFraction(fps).toString())
.addExtraArgs("-pix_fmt", "bgr24")
.addInput("unix://" + socketFile.toAbsolutePath())
.addOutput(output.getAbsolutePath())
.addExtraArgs("-bf", "0")
.setVideoCodec(codec)
.setFormat(format)
.disableAudio()
.done();
FFmpegOutputBuilder builder = mpeg.builder()
.addExtraArgs("-strict", "-2")
.addInput(input.getAbsolutePath())
.addOutput(output.getAbsolutePath())
.setVideoCodec(videoCodec)
.setAudioCodec(audioCodec)
.addExtraArgs("-bf", "0")
.setFormat(format); Just FYI This is what I had to do to get your FFProbe to recognize vvc/h266 videos public class FFProbeWrapper extends FFprobe {
private static final Map<String, String> VERSION_MAP = new ConcurrentHashMap<>();
public FFProbeWrapper(@Nonnull String path) throws IOException {
super(path,new RunProcessFunction() {
@Override
public Process run(List<String> args) throws IOException {
if (args.isEmpty()) {
return super.run(args);
}
List<String> ar = new ArrayList<>();
ar.add(args.getFirst());
ar.add("-strict");
ar.add("-2");
ar.addAll(args.subList(1, args.size()));
return super.run(ar);
}
});
}
@Nonnull
@Override
public synchronized String version() throws IOException {
String s = VERSION_MAP.get(this.getPath());
if (s != null) {
return s;
}
String v = super.version();
VERSION_MAP.put(this.getPath(), v);
return v;
}
} If you need a H266 testfile I can provide one. |
Is your feature request related to a problem? Please describe.
We currently don't allow per-input options; therefore, commands requiring multiple inputs aren't supported in many cases.
For example the following command can't be constructed using this library:
ffmpeg -f lavfi -i "testsrc=duration=10:size=1280x720:rate=30" -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=10" -c:a aac -c:v h264 output.mp4
.Describe the solution you'd like
An FFmpegInputBuilder to construct inputs and allow parameters for individual inputs.
Describe alternatives you've considered
The alternative would be to hack around with addExtraArgs. However, that would undermine the purpose of this library.
Related:
The text was updated successfully, but these errors were encountered: