AVStream 解析

AVStream 是一个结构体

 

//在AVFormatContext中的流索引

iint index; 

 

//流id,例如音频流id 视频流id等;

//解封装的时候,由libavformat模块来赋值

//加封装的时候,由用户设置,如果未设置,则用libavformat替换

int id;  

 

//这是以前版本的时候,封装跟解码耦合在一起,先如今俩者可以分开来,使用codecpar 结构体来替代

AVCodecContext *codec;

 

//这是表示帧时间戳的基本时间单位(以秒为单位) 

AVRational time_base;

 

int64_t start_time;

 

//解码时:流的持续时间,以流的时间为基数。如果源文件没有指定持续时间,但指定了比特率,则该值将根据比特率和文件大小进行估计。

//备注:使用该数值得出视频流的持续时间,计算方式  duration *(time_base.num/time_base.den) 秒。duration的数值有可能为空,所以一般情况下使用AVFormatContext的duration来计算时长。

int64_t duration; 

 

//帧数

int64_t nb_frames;

 

//样本比特率

AVRational sample_aspect_ratio;

 

//平均帧速率

AVRational avg_frame_rate;

 

//与此流相关的编解码器参数。分别在avformat_new_stream()和avformat_free_context()中由libavformat分配和释放。

AVCodecParameters *codecpar;

posted @ 2020-03-12 21:30  helloc14  阅读(784)  评论(0编辑  收藏  举报