Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用jcodec将bytearray(格式为.h264)解码为视频?_Android_Decode_Live Streaming - Fatal编程技术网

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

Android 如何使用jcodec将bytearray(格式为.h264)解码为视频?,android,decode,live-streaming,Android,Decode,Live Streaming,在我的应用程序中,我必须将.h264格式的bytearray解码成视频,并将来自直播的bytearray解码。代码如下: 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

在我的应用程序中,我必须将.h264格式的bytearray解码成视频,并将来自直播的bytearray解码。代码如下:

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();
这里我如何解码视频缓冲区

那我现在能做什么呢


多亏了大家。

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