[英]java ffmpeg wrapper Unknown decoder 'copy'
Hi I want to run ffmpeg -f concat -i test.txt -c copy output.mp4 in java.嗨,我想在 java 中运行ffmpeg -f concat -i test.txt -c copy output.mp4。 My FFmpegBuilder:我的 FFmpegBuilder:
FFmpeg ffmpeg = new FFmpeg("C:\\ffmpeg\\bin\\ffmpeg.exe");
FFprobe ffprobe = new FFprobe("C:\\ffmpeg\\bin\\ffprobe.exe");
FFmpegBuilder builder = new FFmpegBuilder()
.setInput(path + fileName)
.addExtraArgs("-f", "CONCAT")
.addExtraArgs("-i", path+ "test.txt")
.addExtraArgs("-c", "copy")
.addOutput("outjava.mp4")
//.setAudioCodec("COPY")
// .setVideoCodec("COPY")
.done();
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
executor.createJob(builder).run();
But I get always the error:但我总是得到错误:
Unknown decoder 'copy'
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: C:\ffmpeg\bin\ffmpeg.exe returned non-zero exit status. Check stdout.
at net.bramp.ffmpeg.job.SinglePassFFmpegJob.run(SinglePassFFmpegJob.java:46)
at Main.main(Main.java:47)
Caused by: java.io.IOException: C:\ffmpeg\bin\ffmpeg.exe returned non-zero exit status. Check stdout.
at net.bramp.ffmpeg.FFcommon.throwOnError(FFcommon.java:51)
at net.bramp.ffmpeg.FFcommon.run(FFcommon.java:113)
at net.bramp.ffmpeg.FFmpeg.run(FFmpeg.java:184)
at net.bramp.ffmpeg.FFmpeg.run(FFmpeg.java:202)
at net.bramp.ffmpeg.job.SinglePassFFmpegJob.run(SinglePassFFmpegJob.java:39)
... 1 more
Why is it possible to wrap all args into.addExtraArgs, but the -c copy argument is failing?为什么可以将所有 args 包装到 .addExtraArgs 中,但 -c copy 参数失败? What is my mistake?我的错误是什么? .setVideoCodec("COPY") is also failing .setVideoCodec("COPY") 也失败了
-c copy
is an output argument. -c copy
是一个 output 参数。
Place .addExtraArgs("-c", "copy")
after addOutput("outjava.mp4")
:将.addExtraArgs("-c", "copy")
addOutput("outjava.mp4")
之后:
FFmpegBuilder builder = new FFmpegBuilder()
.setInput(path + fileName)
.addExtraArgs("-f", "concat")
.addExtraArgs("-i", path+ "test.txt")
.addOutput("outjava.mp4")
.addExtraArgs("-c", "copy")
.done();
Note: I didn't had the chance to test my answer.注意:我没有机会测试我的答案。
According to the following examples , it should work.根据以下示例,它应该可以工作。
Please note that concat
demuxers with -c copy
only works when all the input files have the same characteristics.请注意,带有-c copy
的concat
demuxers 仅在所有输入文件具有相同特征时才有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.