我正试图用xuggler将一个图像列表编码成一个视频。我有一系列缓冲图像。我使用以下代码。
public void encodeImage(BufferedImage originalImage, long timestamp)
{
// BufferedImage worksWithXugglerBufferedImage = convertToType(originalImage, BufferedImage.TYPE_3BYTE_BGR);
BufferedImage worksWithXugglerBufferedImage = convertToType(originalImage, BufferedImage.TYPE_3BYTE_BGR);
IPacket packet = IPacket.make();
IConverter converter = ConverterFactory.createConverter(worksWithXugglerBufferedImage, IPixelFormat.Type.YUV420P);
IVideoPicture outFrame = converter.toPicture(worksWithXugglerBufferedImage, timestamp * 1000);
outFrame.setQuality(0);
outStreamCoder.encodeVideo(packet, outFrame, 0);
if (packet.isComplete())
outContainer.writePacket(packet);
}问题是它返回给我以下错误。
[WARN] [NioProcessor-1] com.xuggle.xuggler - Got error: picture is not of the same width as this Coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204)
[WARN] [NioProcessor-1] com.xuggle.xuggler - Got error: picture is not of the same width as this Coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204)
[WARN] [NioProcessor-1] com.xuggle.xuggler - Got error: picture is not of the same width as this Coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204)
[WARN] [NioProcessor-1] com.xuggle.xuggler - Got error: picture is not of the same width as this Coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204)
[WARN] [NioProcessor-1] com.xuggle.xuggler - Got error: picture is not of the same width as this Coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204)这个错误是由于outFrame而产生的,我已经检查了创建的帧的宽度和高度,并且图片是相同的。有人能帮我吗或者给我个提示..。
我用了这里的资料。谢谢。
http://wiki.xuggle.com/Encoding_Video_from_a_sequence_of_Images
发布于 2011-12-29 09:48:21
问题是,先生,你一定是把外流的高度和宽度设置错了。e.g
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width); 你应该把你的视频高度正确地放在这里,你的宽度也是如此。
https://stackoverflow.com/questions/8665194
复制相似问题