从 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
I am trying to encode a list of images into a video using xuggler. I have got an array of buffered images. I am using the following code.
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);
}
The problem is its returning me the following error..
[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)
The error is generated due to outFrame
, I have checked the width and height of the frame created and the picture its the same. Can any one help me out here or give me a hint..
I used the source present here. Thank you.
http://wiki.xuggle.com/Encoding_Video_from_a_sequence_of_Images
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是先生,您一定错误地设置了输出流的高度和宽度。例如,
您应该在此处正确输入视频高度,宽度也是如此。
The problem is sir, You must be setting the height and width of your outstream wrongly. e.g
You should put your video height correctly here and so does your width.