我正在尝试将各种视频文件从.mpeg转换为.ogg theora视频。当我在它自己的程序中测试它时,这个命令工作得很好,但是在它想要运行的程序中却无法正常运行。我不明白这是怎么回事。添加-vcodec标志会导致其他错误。
下面是我用来运行ffmpeg的函数
* This method converts a file to Ogg Theora video using ffmpeg.
*
* @param f
* The file to encode. (Assumes that the file has a .mpeg
* extension. If the file doesn't have this, the method will
* fail.)
* @param nice The niceness of the created ffmpeg
* priority.
* @return converter The process that represents ffmpeg working on the file.
*/
private Process encodeFileAsTheora(File f, int nice) {
Process converter = null;
try {
String targetFileName = f.getAbsolutePath()
.replace(".mpeg", ".ogg");
// mLogger.log(Level.INFO,
// "Now attempting to convert " + f.getAbsolutePath());
String[] ffmpegCommand = { "nice", "-n", Integer.toString(nice),
"ffmpeg", "-i", f.getAbsolutePath(), targetFileName };
converter = Runtime.getRuntime().exec(ffmpegCommand);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return converter;
}下面是它对记录器的getErrorStream()输出:
删除非相关内容
配置:--extra-ldflags=-L/home/user/trunk/cpp_src/ffmpeg-source/libvpx --extra-ldflags=-L/home/user/trunk/cpp_src/ffmpeg-source/x264 --extra-cflags=-I/home/user/trunk/cpp_src/ffmpeg-source/x264 --extra-cflags=-I/home/user/trunk/cpp_src/ffmpeg-source/libvpx -启用-libvpx-启用-libvpx 264-启用-gpl --yasmexe=/home/user/trunk/cpp_src/ffmpeg-source/yasm/yasm
发布于 2015-06-22 14:59:55
严重: DDCS -配置:--extra-ldflags=-L/home/user/trunk/cpp_src/ffmpeg-source/libvpx --extra-ldflags=-L/home/user/trunk/cpp_src/ffmpeg-source/x264 --extra-cflags=-I/home/user/trunk/cpp_src/ffmpeg-source/x264 --extra-cflags=-I/home/user/trunk/cpp_src/ffmpeg-source/libvpx -启用-libvpx-启用-libvpx 264-启用-gpl --yasmexe=/home/user/trunk/cpp_src/ffmpeg-source/yasm/yasm
您的ffmpeg不是用libtheora支持编译的,所以您不能编码到ogg/theora。
https://stackoverflow.com/questions/30982874
复制相似问题