2011-12-29 10 views
1

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

答えて

0

問題は、あなたが誤ってあなたのOUTSTREAMの高さと幅を設定する必要があり、先生です。例:

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

ビデオの高さを正しく設定する必要があります。幅も正しく設定してください。

関連する問題