ffmpeg 问题 (mpeg1video -> ?)
ffmpeg problems (mpeg1video -> ?)
我正在尝试将各种视频文件从 .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
SEVERE: DDCS - configuration:
--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
您的 ffmpeg 未使用 libtheora 支持编译,因此您无法编码为 ogg/theora。
我正在尝试将各种视频文件从 .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
SEVERE: DDCS - configuration: --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
您的 ffmpeg 未使用 libtheora 支持编译,因此您无法编码为 ogg/theora。