在android平台下,使用第三方库ffmpeg进行编码,之后播放编码的视频,绿屏了
java
camera.setPreviewCallback(new PreviewCallback()
{
@Override
public void onPreviewFrame(byte[] arg0, Camera arg1) {
// TODO Auto-generated method stub
if(mIsStartPre == true)
{
videostart(arg0);
}
}
});
对每一帧数据都进行编码
JNI接口:
三个接口,一个初始化接口,一个编码接口,一个结束释放接口
AVCodecContext *pCodecCtx= NULL;
AVPacket avpkt;
FILE * video_file;
unsigned char *outbuf=NULL;
unsigned char *yuv420buf=NULL;
AVFrame * yuv420pframe = NULL;
static int outsize=0;
static int mwidth = 480;
static int mheight = 272;
int count = 0;
/*
* encording init
*/
JNIEXPORT jint JNICALL Java_com_hua_cameraandroidtes
java
camera.setPreviewCallback(new PreviewCallback()
{
@Override
public void onPreviewFrame(byte[] arg0, Camera arg1) {
// TODO Auto-generated method stub
if(mIsStartPre == true)
{
videostart(arg0);
}
}
});
对每一帧数据都进行编码
JNI接口:
三个接口,一个初始化接口,一个编码接口,一个结束释放接口
AVCodecContext *pCodecCtx= NULL;
AVPacket avpkt;
FILE * video_file;
unsigned char *outbuf=NULL;
unsigned char *yuv420buf=NULL;
AVFrame * yuv420pframe = NULL;
static int outsize=0;
static int mwidth = 480;
static int mheight = 272;
int count = 0;
/*
* encording init
*/
JNIEXPORT jint JNICALL Java_com_hua_cameraandroidtes