从Xuggler中的帧中获取视频
问题描述:
我试图使用xuggler将图像列表编码成视频。我有一系列缓冲图像。我正在使用下面的代码。从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
答
的问题是,先生,你一定会被错误设置你outstream的高度和宽度。例如
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width);
您应该在此处正确放置视频高度,宽度也应该正确。