java - 从 Xuggler 中的帧获取视频

标签 java eclipse flash-builder xuggle 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

最佳答案

问题是先生,您肯定错误地设置了输出流的高度和宽度。例如

outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width); 

您应该在此处正确输入视频高度,宽度也是如此。

关于java - 从 Xuggler 中的帧获取视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8665194/

相关文章:

actionscript-3 - Adobe AIR Android FileStream 问题

java - 为什么gradle使用2个本地缓存?

java - 按钮未在恢复时保存状态

flash - Flash或Flex是否更好地构建了用户交互式订购“向导”网站?

java - 如何通过 Java 从 Outlook 发送电子邮件?

java - 以独立于机器的方式将 plugin.jar 添加到 eclipse 中的构建路径

java - Actionscript Mobile 项目中的 Photon Cloud 出现 Java 编译错误

java - 允许其他人为我的应用程序开发插件

java - Vertx.io 应用程序的单元测试

java - MapReduce中的SimHash重复数据删除输出