AVFormatContext结构体分析&空间关闭清理

Demo

AVFormatContext 的成员非常多,接下来说一下常用的部分:

一:AVIOContext *pb //IO上下文 自定义格式读/从内存当中读
,av_read_frame 根据 pb结构体来读

image.png

二:char filename[1024] 文件路径文件名,断开重连时用到
image.png
三:AVStream **streams 数组 unsigned int nb_streams 存储音频参数信息
image.png

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

五:int64_t bit_rate 比特率 每秒文件大小 网络适应调整

六:void avformat_close_input(AVFormatContext **s) 关闭输入的上下文,传一个指针地址。
image.png

AVStream

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

(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; 样本率

image.png

image.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值