FFmpeg 5.1.6
|
AVFrame is an abstraction for reference-counted raw multimedia data. More...
Modules | |
AV_FRAME_FLAGS | |
Flags describing additional frame properties. | |
Files | |
file | frame.h |
reference-counted frame API | |
Data Structures | |
struct | AVFrameSideData |
Structure to hold side data for an AVFrame. More... | |
struct | AVRegionOfInterest |
Structure describing a single Region Of Interest. More... | |
struct | AVFrame |
This structure describes decoded (raw) audio or video data. More... | |
Functions | |
attribute_deprecated const char * | av_get_colorspace_name (enum AVColorSpace val) |
Get the name of a colorspace. More... | |
AVFrame * | av_frame_alloc (void) |
Allocate an AVFrame and set its fields to default values. More... | |
void | av_frame_free (AVFrame **frame) |
Free the frame and any dynamically allocated objects in it, e.g. More... | |
int | av_frame_ref (AVFrame *dst, const AVFrame *src) |
Set up a new reference to the data described by the source frame. More... | |
AVFrame * | av_frame_clone (const AVFrame *src) |
Create a new frame that references the same data as src. More... | |
void | av_frame_unref (AVFrame *frame) |
Unreference all the buffers referenced by frame and reset the frame fields. More... | |
void | av_frame_move_ref (AVFrame *dst, AVFrame *src) |
Move everything contained in src to dst and reset src. More... | |
int | av_frame_get_buffer (AVFrame *frame, int align) |
Allocate new buffer(s) for audio or video data. More... | |
int | av_frame_is_writable (AVFrame *frame) |
Check if the frame data is writable. More... | |
int | av_frame_make_writable (AVFrame *frame) |
Ensure that the frame data is writable, avoiding data copy if possible. More... | |
int | av_frame_copy (AVFrame *dst, const AVFrame *src) |
Copy the frame data from src to dst. More... | |
int | av_frame_copy_props (AVFrame *dst, const AVFrame *src) |
Copy only "metadata" fields from src to dst. More... | |
AVBufferRef * | av_frame_get_plane_buffer (AVFrame *frame, int plane) |
Get the buffer reference a given data plane is stored in. More... | |
AVFrameSideData * | av_frame_new_side_data (AVFrame *frame, enum AVFrameSideDataType type, size_t size) |
Add a new side data to a frame. More... | |
AVFrameSideData * | av_frame_new_side_data_from_buf (AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf) |
Add a new side data to a frame from an existing AVBufferRef. More... | |
AVFrameSideData * | av_frame_get_side_data (const AVFrame *frame, enum AVFrameSideDataType type) |
void | av_frame_remove_side_data (AVFrame *frame, enum AVFrameSideDataType type) |
Remove and free all side data instances of the given type. More... | |
int | av_frame_apply_cropping (AVFrame *frame, int flags) |
Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields. More... | |
const char * | av_frame_side_data_name (enum AVFrameSideDataType type) |
AVFrame is an abstraction for reference-counted raw multimedia data.
enum AVFrameSideDataType |
Enumerator | |
---|---|
AV_FRAME_DATA_PANSCAN | The data is the AVPanScan struct defined in libavcodec. |
AV_FRAME_DATA_A53_CC | ATSC A53 Part 4 Closed Captions. A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. The number of bytes of CC data is AVFrameSideData.size. |
AV_FRAME_DATA_STEREO3D | Stereoscopic 3d metadata. The data is the AVStereo3D struct defined in libavutil/stereo3d.h. |
AV_FRAME_DATA_MATRIXENCODING | The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. |
AV_FRAME_DATA_DOWNMIX_INFO | Metadata relevant to a downmix procedure. The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. |
AV_FRAME_DATA_REPLAYGAIN | ReplayGain information in the form of the AVReplayGain struct. |
AV_FRAME_DATA_DISPLAYMATRIX | This side data contains a 3x3 transformation matrix describing an affine transformation that needs to be applied to the frame for correct presentation. See libavutil/display.h for a detailed description of the data. |
AV_FRAME_DATA_AFD | Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVActiveFormatDescription enum. |
AV_FRAME_DATA_MOTION_VECTORS | Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec AVCodecContext flags2 option). The data is the AVMotionVector struct defined in libavutil/motion_vector.h. |
AV_FRAME_DATA_SKIP_SAMPLES | Recommmends skipping the specified number of samples. This is exported only if the "skip_manual" AVOption is set in libavcodec. This has the same format as AV_PKT_DATA_SKIP_SAMPLES. u32le number of samples to skip from start of this packet
u32le number of samples to skip from end of this packet
u8 reason for start skip
u8 reason for end skip (0=padding silence, 1=convergence)
|
AV_FRAME_DATA_AUDIO_SERVICE_TYPE | This side data must be associated with an audio frame and corresponds to enum AVAudioServiceType defined in avcodec.h. |
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA | Mastering display metadata associated with a video frame. The payload is an AVMasteringDisplayMetadata type and contains information about the mastering display color volume. |
AV_FRAME_DATA_GOP_TIMECODE | The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. This is set on the first frame of a GOP that has a temporal reference of 0. |
AV_FRAME_DATA_SPHERICAL | The data represents the AVSphericalMapping structure defined in libavutil/spherical.h. |
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL | Content light level (based on CTA-861.3). This payload contains data in the form of the AVContentLightMetadata struct. |
AV_FRAME_DATA_ICC_PROFILE | The data contains an ICC profile as an opaque octet buffer following the format described by ISO 15076-1 with an optional name defined in the metadata key entry "name". |
AV_FRAME_DATA_S12M_TIMECODE | Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t where the first uint32_t describes how many (1-3) of the other timecodes are used. The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum() function in libavutil/timecode.h. |
AV_FRAME_DATA_DYNAMIC_HDR_PLUS | HDR dynamic metadata associated with a video frame. The payload is an AVDynamicHDRPlus type and contains information for color volume transform - application 4 of SMPTE 2094-40:2016 standard. |
AV_FRAME_DATA_REGIONS_OF_INTEREST | Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size. |
AV_FRAME_DATA_VIDEO_ENC_PARAMS | Encoding parameters for a video frame, as described by AVVideoEncParams. |
AV_FRAME_DATA_SEI_UNREGISTERED | User data unregistered metadata associated with a video frame. This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte. |
AV_FRAME_DATA_FILM_GRAIN_PARAMS | Film grain parameters for a frame, described by AVFilmGrainParams. Must be present for every frame which should have film grain applied. |
AV_FRAME_DATA_DETECTION_BBOXES | Bounding boxes for object detection and classification, as described by AVDetectionBBoxHeader. |
AV_FRAME_DATA_DOVI_RPU_BUFFER | Dolby Vision RPU raw data, suitable for passing to x265 or other libraries. Array of uint8_t, with NAL emulation bytes intact. |
AV_FRAME_DATA_DOVI_METADATA | Parsed Dolby Vision metadata, suitable for passing to a software implementation. The payload is the AVDOVIMetadata struct defined in libavutil/dovi_meta.h. |
AV_FRAME_DATA_DYNAMIC_HDR_VIVID | HDR Vivid dynamic metadata associated with a video frame. The payload is an AVDynamicHDRVivid type and contains information for color volume transform - CUVA 005.1-2021. |
anonymous enum |
Flags for frame cropping.
Enumerator | |
---|---|
AV_FRAME_CROP_UNALIGNED | Apply the maximum possible cropping, even if it requires setting the AVFrame.data[] entries to unaligned pointers. Passing unaligned data to FFmpeg API is generally not allowed, and causes undefined behavior (such as crashes). You can pass unaligned data only to FFmpeg APIs that are explicitly documented to accept it. Use this flag only if you absolutely know what you are doing. |
attribute_deprecated const char * av_get_colorspace_name | ( | enum AVColorSpace | val | ) |
Get the name of a colorspace.
AVFrame * av_frame_alloc | ( | void | ) |
Allocate an AVFrame and set its fields to default values.
The resulting struct must be freed using av_frame_free().
Referenced by alloc_audio_frame(), alloc_picture(), dec_enc(), decode_write(), init_filters(), init_input_frame(), init_output_frame(), main(), and open_input_file().
void av_frame_free | ( | AVFrame ** | frame | ) |
Free the frame and any dynamically allocated objects in it, e.g.
extended_data. If the frame is reference counted, it will be unreferenced first.
frame | frame to be freed. The pointer will be set to NULL. |
Referenced by close_stream(), dec_enc(), decode_write(), init_output_frame(), load_encode_and_write(), main(), and read_decode_convert_and_store().
Set up a new reference to the data described by the source frame.
Copy frame properties from src to dst and create a new reference for each AVBufferRef from src.
If src is not reference counted, new buffers are allocated and the data is copied.
Create a new frame that references the same data as src.
This is a shortcut for av_frame_alloc()+av_frame_ref().
void av_frame_unref | ( | AVFrame * | frame | ) |
Unreference all the buffers referenced by frame and reset the frame fields.
Referenced by decode_packet(), filter_encode_write_frame(), and main().
Move everything contained in src to dst and reset src.
int av_frame_get_buffer | ( | AVFrame * | frame, |
int | align | ||
) |
Allocate new buffer(s) for audio or video data.
The following fields must be set on frame before calling this function:
This function will fill AVFrame.data and AVFrame.buf arrays and, if necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. For planar formats, one buffer will be allocated for each plane.
frame | frame in which to store the new buffers. |
align | Required buffer size alignment. If equal to 0, alignment will be chosen automatically for the current CPU. It is highly recommended to pass 0 here unless you know what you are doing. |
Referenced by alloc_audio_frame(), alloc_picture(), get_input(), init_output_frame(), and main().
int av_frame_is_writable | ( | AVFrame * | frame | ) |
Check if the frame data is writable.
If 1 is returned the answer is valid until av_buffer_ref() is called on any of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
int av_frame_make_writable | ( | AVFrame * | frame | ) |
Ensure that the frame data is writable, avoiding data copy if possible.
Do nothing if the frame is writable, allocate new buffers and copy the data if it is not.
Referenced by get_video_frame(), main(), and write_audio_frame().
Copy the frame data from src to dst.
This function does not allocate anything, dst must be already initialized and allocated with the same parameters as src.
This function only copies the frame data (i.e. the contents of the data / extended data arrays), not any other properties.
Copy only "metadata" fields from src to dst.
Metadata for the purpose of this function are those fields that do not affect the data layout in the buffers. E.g. pts, sample rate (for audio) or sample aspect ratio (for video), but not width/height or channel layout. Side data is also copied.
AVBufferRef * av_frame_get_plane_buffer | ( | AVFrame * | frame, |
int | plane | ||
) |
Get the buffer reference a given data plane is stored in.
plane | index of the data plane of interest in frame->extended_data. |
AVFrameSideData * av_frame_new_side_data | ( | AVFrame * | frame, |
enum AVFrameSideDataType | type, | ||
size_t | size | ||
) |
Add a new side data to a frame.
frame | a frame to which the side data should be added |
type | type of the added side data |
size | size of the side data |
AVFrameSideData * av_frame_new_side_data_from_buf | ( | AVFrame * | frame, |
enum AVFrameSideDataType | type, | ||
AVBufferRef * | buf | ||
) |
Add a new side data to a frame from an existing AVBufferRef.
frame | a frame to which the side data should be added |
type | the type of the added side data |
buf | an AVBufferRef to add as side data. The ownership of the reference is transferred to the frame. |
AVFrameSideData * av_frame_get_side_data | ( | const AVFrame * | frame, |
enum AVFrameSideDataType | type | ||
) |
Referenced by decode_packet().
void av_frame_remove_side_data | ( | AVFrame * | frame, |
enum AVFrameSideDataType | type | ||
) |
Remove and free all side data instances of the given type.
int av_frame_apply_cropping | ( | AVFrame * | frame, |
int | flags | ||
) |
Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields.
If cropping is successful, the function will adjust the data pointers and the width/height fields, and set the crop fields to 0.
In all cases, the cropping boundaries will be rounded to the inherent alignment of the pixel format. In some cases, such as for opaque hwaccel formats, the left/top cropping is ignored. The crop fields are set to 0 even if the cropping was rounded or ignored.
frame | the frame which should be cropped |
flags | Some combination of AV_FRAME_CROP_* flags, or 0. |
const char * av_frame_side_data_name | ( | enum AVFrameSideDataType | type | ) |