简体   繁体   中英

how to decode the bytearray(which is in .h264 format) in to video by using jcodec?

In My App,I have to decode the bytearray(that is in .h264 format) in to video and the bytearray coming from live steaming.The code is below,

static final int VIDEO_BUF_SIZE = 100000;
 static final int FRAME_INFO_SIZE = 16;
 byte[] frameInfo = new byte[FRAME_INFO_SIZE];
 byte[] videoBuffer = new byte[VIDEO_BUF_SIZE];

File SDFile = android.os.Environment.getExternalStorageDirectory();

File destDir = new File(SDFile.getAbsolutePath() + "/test.h264");


//avRecvFrameData returns the length of the frame and stores it in ret.
int ret = av.avRecvFrameData(avIndex, videoBuffer,
                        VIDEO_BUF_SIZE, frameInfo, FRAME_INFO_SIZE,
                        frameNumber);

fos=new FileOutputStream(destDir,true);
                fos.write(videoBuffer, 0, ret);
                fos.close();

Here how can i decode the videobuffer(bytearray)?

So what Can I do now.

Thanks to All.

没有官方的android api可以直接解码H.264帧,唯一的方法是将ffmpeg移植到android并使用jni包装解码功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM