ffmpeg视频编解码课程教学视频:https://edu.csdn.net/course/detail/27795
课件里面提供源码资料
一、ffmpeg初始化
av_register_all(); //初始化FFMPEG
二、查找编码器
//==================================== 查找编码器 ===============================//
AVCodecID codec_id=AV_CODEC_ID_H264;
pCodec = avcodec_find_encoder(codec_id);
if (!pCodec)
{
printf("Codec not found\n");
return ;
}
三、编码器分配空间、属性设置
pCodecCtx = avcodec_alloc_context3(pCodec);