首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Xuggler中的帧中获取视频

从Xuggler中的帧中获取视频
EN

Stack Overflow用户
提问于 2011-12-29 07:41:58
回答 1查看 1.8K关注 0票数 1

我正试图用xuggler将一个图像列表编码成一个视频。我有一系列缓冲图像。我使用以下代码。

代码语言:javascript
复制
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); 

}

问题是它返回给我以下错误。

代码语言:javascript
复制
[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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-29 09:48:21

问题是,先生,你一定是把外流的高度和宽度设置错了。e.g

代码语言:javascript
复制
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width); 

你应该把你的视频高度正确地放在这里,你的宽度也是如此。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8665194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档