Eu estou tentando codificar uma lista de imagens em um vídeo usando o xuggler. Eu tenho uma matriz de imagens em buffer. Estou usando o seguinte código.
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);
}
O problema é a devolução do seguinte erro.
[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)
O erro é gerado devido a outFrame
, Verifiquei a largura e a altura do quadro criado e a imagem é a mesma. Alguém pode me ajudar aqui ou me dar uma dica ..
Eu usei a fonte presente aqui. Obrigado.
http://wiki.xuggle.com/Encoding_Video_from_a_sequence_of_Images
Respostas:
0 para resposta № 1O problema é o senhor, você deve estar definindo a altura e largura do seu outstream de forma errada. por exemplo
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width);
Você deve colocar a altura do vídeo corretamente aqui e a largura também.