FFmpeg函数记录1

1.为AVFrame重新分配空间

 int av_frame_get_buffer(AVFrame *frame, int align);

align指位深度。

2.取消引用的所有缓冲区并重置AVFrame

void av_frame_unref(AVFrame *frame);

3.复制图片平面

void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
                         const uint8_t *src, int src_linesize,

                         int bytewidth, int height);  

bytewidth不能大于src_linesize和dst_linesize。

4.复制AVFrame元数据

int av_frame_copy_props(AVFrame *dst, const AVFrame *src)

元数据指视频的一些非数据字段。

5.设置参数字典的参数

AVDictionary *options = NULL;

av_dict_set(&options, "stimeout", "3000000", 0);//设置等待时间

6.释放参数字典

AVDictionary *options = NULL;

av_dict_set(&options, "stimeout", "3000000", 0);//设置等待时间

使用完后释放:av_dict_free(&options);

7.av_dump_format

av_dump_format(m_netStream_In_AVFormatContext, 0,m_netStreamInFileName, 0);

m_netStreamInFileName为文件路径或流链接。

打印详细信息,如持续时间、比特率、流、容器、程序元数据,基础数据,编解码器和时间

dump只是个调试函数,输出文件的音、视频流的基本信息了,帧率、分辨率、音频采样等等。

8.把错误码转出错误信息

char errmsg[1024];
av_strerror(netSamples, errmsg, sizeof(errmsg));
av_log(NULL, AV_LOG_WARNING, "[%s:%d] swr_convert!(%d)(%s)", __FILE__, __LINE__, netSamples, errmsg);

猜你喜欢

转载自blog.csdn.net/xionglifei2014/article/details/80206394
今日推荐