簡體   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