【发布时间】:2015-07-03 21:02:19
【问题描述】:
我正在尝试将各种视频文件从 .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 --enable-libvpx -- enable-libx264 --enable-gpl --yasmexe=/home/user/trunk/cpp_src/ffmpeg-source/yasm/yasm
【问题讨论】: