简体   繁体   English

如何使用jcodec将bytearray(.h264格式)解码为视频?

[英]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, 在我的应用程序中,我必须将字节数组(.h264格式)解码为视频,然后将字节数组从实时流式传输中删除。代码如下,

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)? 在这里我如何解码videobuffer(bytearray)?

So what Can I do now. 那我现在该怎么办。

Thanks to All. 谢谢大家。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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