1

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

4

1 に答える 1

0

問題は、アウトストリームの高さと幅を間違って設定しているに違いありません。例えば

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

ここにビデオの高さを正しく配置し、幅も正しく配置する必要があります。

于 2011-12-29T09:48:21.170 に答える