我正在尝试使用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
答案 0 :(得分:0)
问题是先生,你必须错误地设置你的游戏的高度和宽度。 e.g
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width);
你应该在这里正确放置你的视频高度,你的宽度也是如此。