カメラから H264 raw プロトコルをデコードしようとしていますが、Jcodec H264Decoder の使用に問題があります。カメラからの情報を含む整数の配列を受け取ります。データのサンプルの下:
配列: 00 00 01 FD 00 00 14 69 00 00 00 01 61 E4 80 6F D3 5B 76 97 DF 04 3A EF 54 97 0E D9 F5...詳細
私が使用しているコードは次のとおりです。
ByteBuffer bb = ByteBuffer.wrap( Utils.intArrayToByteArray(array, arraySize) );
bb.rewind();
// Create a buffer to hold the output picture which is big enough
Picture outBuffer = Picture.create( 1920, 1088, ColorSpace.YUV420 );
Picture pic = _decoder.decodeFrame( bb, outBuffer.getData() );
BufferedImage bufferedImage = JCodecUtil.toBufferedImage( pic );
実行しようとすると、次のように NullPointerException が発生します。
スレッド「Thread-6」での例外 java.lang.NullPointerException at org.jcodec.codecs.h264.H264Decoder$FrameDecoder.decodeFrame(H264Decoder.java:82) at org.jcodec.codecs.h264.H264Decoder.decodeFrame(H264Decoder.java) :61) br.com.grupogiga.security.xm.player.jcodec.JCodecPlayer.test_readNals(JCodecPlayer.java:122) で br.com.grupogiga.security.xm.player.jcodec.JCodecPlayer.processNAL(JCodecPlayer.java) :69) br.com.grupogiga.security.xm.player.XMH264Player$1$2.NALArrived(XMH264Player.java:143) br.com.grupogiga.security.xm.protocols.ProtocolParser.emitNALArrived(ProtocolParser.java:408) ) br.com.grupogiga.security.xm.protocols.ProtocolParser.run(ProtocolParser.java:121) で java.lang.Thread.run(Thread.java:722) で
私が間違っていることは何ですか?? JCodec を使用してデータをデコードするにはどうすればよいですか? 前もって感謝します。