如何将字节数组(.h264格式)的视频在解码的Android?

问题描述 投票:1回答:1

我的应用程序,我必须在视频的ByteArray(即在.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();

所以,我能怎么办呢? 谢谢大家。

android video-streaming decode
1个回答
2
投票

我已经使用javacv库进行H.264实时流的解码。其相当不错的图书馆。这里是我的question及其答案,它可以帮助你。如果执行类似的步骤,因为我已经完成,它将解码视频,你将能够发挥它的设备。

© www.soinside.com 2019 - 2024. All rights reserved.