- 论坛徽章:
- 0
|
大哥们好,我现在找到了H264的视频流,不想解码,想直接存成Mp4文件或flv文件。但不知道用哪个接口去存。请各位大哥指导下!
下面是找到视频流的部分,大哥们给我个用哪个库函数去存视频流的接口就可以了。或者给个小demo也许。
// Open video file
char *rtsp = "rtsp://192.168.230.150:554/axis-media/media.amp?videocodec=h264";
if(avformat_open_input(&pFormatCtx, (const char *)rtsp, NULL,NULL)!=0)
{
printf("==========avformat_open_input========\n");
return -1;
}
// Retrieve stream information
if(av_find_stream_info(pFormatCtx)<0)
{
printf("==========av_find_stream_info=====\n");
return -1;
}
// Dump information about file onto standard error
//av_dump_format(pFormatCtx, 0, (const char*)rtsp, 0);
// Find the first video stream
videoStream=-1;
for(i=0; i<pFormatCtx->nb_streams; i++)
{
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
{
videoStream=i;
break;
}
} |
|