AVFormatContext 的成员非常多,接下来说一下常用的部分:
一:AVIOContext *pb //IO上下文 自定义格式读/从内存当中读
,av_read_frame 根据 pb结构体来读

二:char filename[1024] 文件路径文件名,断开重连时用到

三:AVStream **streams 数组 unsigned int nb_streams 存储音频参数信息

四: int64_t duration //AV_TIME_BASE 总长度 微妙 (不一定能获取到,如果没有的话要自行处理)

五:int64_t bit_rate 比特率 每秒文件大小 网络适应调整
六:void avformat_close_input(AVFormatContext **s) 关闭输入的上下文,传一个指针地址。

AVStream
(1) AVRational time_base 一个分数,时间基数 和duration有关

(2) int64_t duration //毫秒int64_t nb_frames; 不一定有
(3) AVRational avg_frame_rate 帧率 (分数表示)
(4) AVCodecParameters *codecpar (音视频参数) 替代codec
• enum AVMediaType codec_type; 音频/视频(codec_type AVMediaType AVMEDIA_TYPE_VIDEO)
• enum AVCodecID codec_id (编码格式 codec_id AVCodecID AV_CODEC_ID_H264)
• uint32_t codec_tag(编码器)
• int format(像素格式,音频采样格式)
• int width;int height(宽高)
• uint64_t channel_layout
• int frame_size;一帧音频大小
• int channels; 声道数
• int sample_rate; 样本率


网友评论