美文网首页
FFmpeg结构体:AVFrame

FFmpeg结构体:AVFrame

作者: YellowLayne | 来源:发表于2017-03-13 14:11 被阅读0次

1.描述

AVFrame用来存储解码后的(或原始)音频或视频数据,位于avcodec.h文件中。
AVFrame必须由av_frame_alloc()分配内存,同时必须由av_frame_free()释放。
AVFrame分配内存后能够被多次用来存储不同的数据(例如:decoder解码后的帧)。av_frame_unref释放任何持帧的引用,并结构体还原到未被使用的状态。

2.常见变量及其作用

uint8_t *   data [AV_NUM_DATA_POINTERS];//解码后原始数据(对视频来说是YUV,RGB,对音频来说是PCM)。
int linesize[AV_NUM_DATA_POINTERS];//在视频中,表示图片一行数据的大小。
uint8_t **extended_data;//指向数据平面/通道。
int width, height;//一个视频帧的宽度和高度。
int nb_samples;//这个AVFrame中的每个音频通道中包含的音频帧个数。
int format;//表示解码后的数据类型或格式,-1表示未被设置或不能识别的类型。
int key_frame;//是否为关键帧。
enum AVPictureType pict_type;//帧的类型。
AVRational sample_aspect_ratio;//视频帧的宽高比,0表示未知。
int64_t pts;//显示时间戳,表示该什么时候被显示。
int64_t pkt_dts;//从AVPacket中拷贝的值。
int coded_picture_number;//编码帧序号。
int display_picture_number;//显示帧需要。
void *opaque;//用户私有信息。
int repeat_pict;//解码时,每帧图片延迟的时间,extra_delay = repeat_pict / (2*fps)。
int interlaced_frame;//是否是隔行扫描
int sample_rate;//音频的采样率。
uint64_t channel_layout;//音频的布局方式。
/**
* MPEG vs JPEG YUV range.
* - encoding: Set by user
* - decoding: Set by libavcodec
*/
enum AVColorRange color_range;
enum AVColorPrimaries color_primaries;
enum AVColorTransferCharacteristic color_trc;

/**
* YUV colorspace type.
* - encoding: Set by user
* - decoding: Set by libavcodec
*/
enum AVColorSpace colorspace;
enum AVChromaLocation chroma_location;

/**
* frame timestamp estimated using various heuristics, in stream time base
* - encoding: unused
* - decoding: set by libavcodec, read by user.
*/
int64_t best_effort_timestamp;

/**
* reordered pos from the last AVPacket that has been input into the decoder
* - encoding: unused
* - decoding: Read by user.
*/
int64_t pkt_pos;

/**
     * duration of the corresponding packet, expressed in
     * AVStream->time_base units, 0 if unknown.
     * - encoding: unused
     * - decoding: Read by user.
*/
int64_t pkt_duration;

/**
     * metadata.
     * - encoding: Set by user.
     * - decoding: Set by libavcodec.
     */
    AVDictionary *metadata;

    /**
     * decode error flags of the frame, set to a combination of
     * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
     * were errors during the decoding.
     * - encoding: unused
     * - decoding: set by libavcodec, read by user.
     */
int decode_error_flags;

    /**
     * number of audio channels, only used for audio.
     * - encoding: unused
     * - decoding: Read by user.
     */
int channels;//音频通道个数

    /**
     * size of the corresponding packet containing the compressed
     * frame.
     * It is set to a negative value if unknown.
     * - encoding: unused
     * - decoding: set by libavcodec, read by user.
     */
int pkt_size;

int8_t *qscale_table;
int qstride;
int qscale_type;
AVBufferRef *qp_table_buf;

    /**
     * For hwaccel-format frames, this should be a reference to the
     * AVHWFramesContext describing the frame.
     */
AVBufferRef *hw_frames_ctx;

    /**
     * AVBufferRef for free use by the API user. FFmpeg will never check the
     * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
     * the frame is unreferenced. av_frame_copy_props() calls create a new
     * reference with av_buffer_ref() for the target frame's opaque_ref field.
     *
     * This is unrelated to the opaque field, although it serves a similar
     * purpose.
     */
AVBufferRef *opaque_ref;

相关文章

  • FFmpeg结构体:AVFrame

    1.描述 AVFrame用来存储解码后的(或原始)音频或视频数据,位于avcodec.h文件中。AVFrame必须...

  • FFMpeg入门学习笔记(1)常用变量

    FFmpeg主要构成 常用变量:AVFrame:包含码流参数较多的结构体 AVFormatContext:包含码流...

  • FFMPEG结构体分析:AVFrame

    在此不再详述,其中AVFrame是包含码流参数较多的结构体。本文将会详细分析一下该结构体里主要变量的含义和作用。(...

  • AVFrame结构

    结构体AVFrame的定义的结构体源码(位于libavcodec/avcodec.h)中;AVFrame结构体一般...

  • ffmpeg是如何计算linesize的

    ffmpeg的AVFrame结构体,有个linesize的成员,记录了某个分量行与行之间相隔了多少个字节。今天测试...

  • ffmpeg核心结构体AVPacket/AVFrame

    AVPacket: 存储解码前数据(编码数据:H264/AAC等)AVFrame: 存储解码后数据(像素数据:YU...

  • 多媒体开发(18):FFmpeg的常见结构体

    除了之前讲的avpacket跟avframe,FFmpeg还有其它一些结构经常在流程中出现。FFmpeg还有哪些常...

  • ffmpeg学习笔记 二

    AVFrame AVFrame是包含码流参数较多的结构体。本文将会详细分析一下该结构体里主要变量的含义和作用。首先...

  • ffmpeg学习笔记二

    AVFrame AVFrame是包含码流参数较多的结构体。本文将会详细分析一下该结构体里主要变量的含义和作用。首先...

  • ffmpeg之-AVFrame解析(五)

    前言 AVFrame 位于libavutil/frame.h中,AVpacket一样,是FFmpeg中很重要的结构...

网友评论

      本文标题:FFmpeg结构体:AVFrame

      本文链接:https://www.haomeiwen.com/subject/agefnttx.html