繁体   English   中英

从Xuggler的帧中获取视频

[英]Get Video from frames in 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); 

您应该在此处正确放置视频高度,宽度也应正确放置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM