FFmpeg
Data Fields
AVFrame Struct Reference

This structure describes decoded (raw) audio or video data. More...

#include <frame.h>

Data Fields

uint8_t * data [AV_NUM_DATA_POINTERS]
 pointer to the picture/channel planes. More...
 
int linesize [AV_NUM_DATA_POINTERS]
 For video, a positive or negative value, which is typically indicating the size in bytes of each picture line, but it can also be: More...
 
uint8_t ** extended_data
 pointers to the data planes/channels. More...
 
int nb_samples
 number of audio samples (per channel) described by this frame More...
 
int format
 format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio) More...
 
attribute_deprecated int key_frame
 1 -> keyframe, 0-> not More...
 
enum AVPictureType pict_type
 Picture type of the frame. More...
 
AVRational sample_aspect_ratio
 Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. More...
 
int64_t pts
 Presentation timestamp in time_base units (time when frame should be shown to user). More...
 
int64_t pkt_dts
 DTS copied from the AVPacket that triggered returning this frame. More...
 
AVRational time_base
 Time base for the timestamps in this frame. More...
 
int quality
 quality (between 1 (good) and FF_LAMBDA_MAX (bad)) More...
 
void * opaque
 Frame owner's private data. More...
 
int repeat_pict
 Number of fields in this frame which should be repeated, i.e. More...
 
attribute_deprecated int interlaced_frame
 The content of the picture is interlaced. More...
 
attribute_deprecated int top_field_first
 If the content is interlaced, is top field displayed first. More...
 
attribute_deprecated int palette_has_changed
 Tell user application that palette has changed from previous frame. More...
 
int sample_rate
 Sample rate of the audio data. More...
 
AVBufferRefbuf [AV_NUM_DATA_POINTERS]
 AVBuffer references backing the data for this frame. More...
 
AVBufferRef ** extended_buf
 For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf. More...
 
int nb_extended_buf
 Number of elements in extended_buf. More...
 
AVFrameSideData ** side_data
 
int nb_side_data
 
int flags
 Frame flags, a combination of AV_FRAME_FLAGS. More...
 
enum AVColorRange color_range
 MPEG vs JPEG YUV range. More...
 
enum AVColorPrimaries color_primaries
 
enum AVColorTransferCharacteristic color_trc
 
enum AVColorSpace colorspace
 YUV colorspace type. More...
 
enum AVChromaLocation chroma_location
 
int64_t best_effort_timestamp
 frame timestamp estimated using various heuristics, in stream time base More...
 
attribute_deprecated int64_t pkt_pos
 reordered pos from the last AVPacket that has been input into the decoder More...
 
AVDictionarymetadata
 metadata. More...
 
int decode_error_flags
 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. More...
 
attribute_deprecated int pkt_size
 size of the corresponding packet containing the compressed frame. More...
 
AVBufferRefhw_frames_ctx
 For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame. More...
 
AVBufferRefopaque_ref
 Frame owner's private data. More...
 
AVBufferRefprivate_ref
 AVBufferRef for internal use by a single libav* library. More...
 
AVChannelLayout ch_layout
 Channel layout of the audio data. More...
 
int64_t duration
 Duration of the frame, in the same units as pts. More...
 
Video dimensions

Video frames only.

The coded dimensions (in pixels) of the video frame, i.e. the size of the rectangle that contains some well-defined values.

Note
The part of the frame intended for display/presentation is further restricted by the Cropping rectangle.
int width
 
int height
 
Cropping

Video frames only. The number of pixels to discard from the the top/bottom/left/right border of the frame to obtain the sub-rectangle of the frame intended for presentation.

size_t crop_top
 
size_t crop_bottom
 
size_t crop_left
 
size_t crop_right
 

Detailed Description

This structure describes decoded (raw) audio or video data.

AVFrame must be allocated using av_frame_alloc(). Note that this only allocates the AVFrame itself, the buffers for the data must be managed through other means (see below). AVFrame must be freed with av_frame_free().

AVFrame is typically allocated once and then reused multiple times to hold different data (e.g. a single AVFrame to hold frames received from a decoder). In such a case, av_frame_unref() will free any references held by the frame and reset it to its original clean state before it is reused again.

The data described by an AVFrame is usually reference counted through the AVBuffer API. The underlying buffer references are stored in AVFrame.buf / AVFrame.extended_buf. An AVFrame is considered to be reference counted if at least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, every single data plane must be contained in one of the buffers in AVFrame.buf or AVFrame.extended_buf. There may be a single buffer for all the data, or one separate buffer for each plane, or anything in between.

sizeof(AVFrame) is not a part of the public ABI, so new fields may be added to the end with a minor bump.

Fields can be accessed through AVOptions, the name string used, matches the C structure field name for fields accessible through AVOptions.

Examples
decode_audio.c, decode_filter_audio.c, decode_filter_video.c, decode_video.c, demux_decode.c, encode_audio.c, encode_video.c, extract_mvs.c, filter_audio.c, hw_decode.c, mux.c, qsv_decode.c, qsv_transcode.c, transcode.c, transcode_aac.c, vaapi_encode.c, and vaapi_transcode.c.

Definition at line 389 of file frame.h.

Field Documentation

◆ data

uint8_t* AVFrame::data[AV_NUM_DATA_POINTERS]

pointer to the picture/channel planes.

This might be different from the first allocated byte. For video, it could even point to the end of the image data.

All pointers in data and extended_data must point into one of the AVBufferRef in buf or extended_buf.

Some decoders access areas outside 0,0 - width,height, please see avcodec_align_dimensions2(). Some filters and swscale can read up to 16 bytes beyond the planes, if these filters are to be used, then 16 extra bytes must be allocated.

NOTE: Pointers not needed by the format MUST be set to NULL.

Attention
In case of video, the data[] pointers can point to the end of image data in order to reverse line order, when used in combination with negative values in the linesize[] array.
Examples
hw_decode.c, mux.c, qsv_decode.c, and vaapi_encode.c.

Definition at line 410 of file frame.h.

Referenced by aac_decode_er_frame(), alloc_base_frame(), alloc_picture(), aom_decode(), aom_encode(), apng_encode_frame(), apply_motion_generic(), audio_decode_frame(), averageiir2d(), avgblur_opencl_filter_frame(), avs_decode_frame(), avui_decode_frame(), avui_encode_frame(), bethsoftvid_decode_frame(), bilateralo_planes(), black_counter(), blend_frame_partial(), blockdetect_filter_frame(), blur(), blur_frame(), blur_planes(), blurdetect_filter_frame(), bmp_decode_frame(), bmp_encode_frame(), calc_avgy16(), calc_avgy8(), calc_diffs(), calculate_sums(), call_cuda_kernel(), call_resize_kernel(), cas_slice16(), cas_slice8(), cdg_border_preset(), cdg_decode_flush(), cdg_decode_frame(), cdg_load_palette(), cdg_scroll(), cdg_tile_block(), cfhd_decode(), channelmap_filter_frame(), chroma_mc_bi(), cinvideo_decode_frame(), color_balance16(), color_balance16_p(), color_balance8(), color_balance8_p(), colormap_slice(), comp_block(), compare(), compare_fields(), compute_crc_of_packets(), compute_sat_hue_metrics16(), compute_sat_hue_metrics8(), config_output(), config_video_output(), control_port_cb(), conv_cuda_convert(), convert(), convert_frame(), convert_frame_partial(), convolve(), copy_uv_planes(), cover_rect(), cri_decode_frame(), cuda_bilateral_process_internal(), cudachromakey_process_internal(), cuvid_output_frame(), d3d12va_encode_issue(), deband_16_c(), deband_16_coupling_c(), deband_8_c(), deband_8_coupling_c(), decimate_frame(), decode_argb(), decode_argb_frame(), decode_argbi(), decode_argx(), decode_argxi(), decode_aybr(), decode_aybri(), decode_block(), decode_blocks(), decode_byry(), decode_byryi(), decode_c82i(), decode_c82p(), decode_ca2i(), decode_ca2p(), decode_ca4i(), decode_ca4p(), decode_frame(), decode_frame_common(), decode_frame_ga(), decode_idat_chunk(), decode_inter(), decode_inter_plane(), decode_mb_row_no_filter(), decode_packet(), decode_rgb(), decode_rgb24_frame(), decode_rgbi(), decode_rgbx(), decode_rgbxi(), decode_rle(), decode_rle16(), decode_rle_bpp2(), decode_rle_bpp4(), decode_slice(), decode_slice_thread(), decode_write(), decode_ybr(), decode_ybr10(), decode_ybr10i(), decode_ybri(), decode_ybyr(), decode_yry10(), decode_yry10i(), decode_yuv_frame(), deint_vaapi_filter_frame(), deinterlace_plane_slice(), deinterlace_slice(), deshake_transform_c(), detect_scene_change(), diagonal_transformation(), disp_palette(), displace_packed(), displace_planar(), do_alphamerge(), do_denoise(), do_morpho(), do_vflip(), downscale(), draw_axis_rgb(), draw_axis_yuv(), draw_blank_frame(), draw_horiz_band(), draw_sono(), draw_spatial(), drawline(), drawtext(), dxtory_decode_v1_410(), dxtory_decode_v1_420(), dxtory_decode_v1_444(), dxtory_decode_v1_rgb(), dxva2_unmap_frame(), encode(), encode_apng(), encode_bitstream(), encode_frame(), encode_gbrp10(), encode_gbrp12(), encode_headers(), encode_picture_ls(), encode_rgb48_10bit(), encode_slice(), epx2_slice(), epx3_slice(), escape130_decode_frame(), estimate_best_b_count(), eval_motion_dist(), exposure_slice(), extend_edges(), ff_aom_apply_film_grain(), ff_aom_image_copy_16_to_8(), ff_apply_vector_2x2(), ff_apply_vector_4x4(), ff_h263_decode_frame(), ff_h274_apply_film_grain(), ff_mpeg4_encode_mb(), ff_sws_slice_worker(), ff_vaapi_get_surface_id(), ff_vdpau_get_surface_id(), ff_vk_decode_prepare_frame(), ff_vk_exec_add_dep_frame(), ff_vk_exec_mirror_sem_value(), ff_vk_exec_update_frame(), ff_vk_frame_barrier(), ffmal_copy_frame(), ffmmal_add_packet(), ffmmal_fill_input_port(), fill_picture(), fill_picture_monoblack(), fill_picture_rgb(), fill_yuv_image(), filter(), filter16_brng(), filter16_tout(), filter16_vrep(), filter8_brng(), filter8_tout(), filter8_vrep(), filter_1phase(), filter_frame(), filter_mb_row(), filter_slice(), filter_slice_grey_edge(), filter_slice_packed(), filter_slice_planar(), filter_slice_rgba_packed(), filter_slice_rgba_planar(), find_min_max(), find_min_max_16(), find_min_max_planar(), find_min_max_planar_16(), fits_encode_frame(), flashsv2_encode_frame(), flashsv_encode_frame(), flip_bayer(), g2m_decode_frame(), gather_data_for_cel(), gather_data_for_subcel(), gem_decode_frame(), get_input(), get_scene_score(), get_zeropadded_input(), decklink_frame::GetBytes(), getpix(), getpix_integrate(), gif_encode_frame(), gif_fill(), gif_fill_rect(), handle_p_frame_apng(), handle_p_frame_png(), handle_small_bpp(), hdr_decode_frame(), headphone_convolute(), headphone_fast_convolute(), hls_prediction_unit(), horizontal_frame_pack(), host_map_frame(), hqx_filter(), import_map(), init(), inject_frame(), inter_pred(), interleave_cols_to_any(), interp_lowres(), interpolate(), ir2_decode_frame(), is_frozen(), jpeg2000_decode_frame(), lag_decode_frame(), libuavs3d_decode_frame(), libx265_encode_frame(), limitdiff_slice(), load_input_picture(), load_palette(), lowpass16(), luma_abs_diff(), luma_mc_bi(), magy_decode_frame(), magy_decode_slice(), magy_decode_slice10(), main(), maskedclamp_slice(), maskedminmax_slice(), match_video_size(), mc_dir_part(), mc_scaled(), mc_uni_scaled(), mjpeg_decode_scan(), morpho_slice(), msp2_decode_frame(), msrle_decode_8_16_24_32(), msrle_decode_pal4(), msrle_encode_frame(), multiply_slice(), mxpeg_check_dimensions(), mxpeg_decode_frame(), nppscale_deinterleave(), nppscale_interleave(), nppscale_resize(), nppsharpen_sharpen(), npptranspose_rotate(), npptranspose_transpose(), omx_encode_frame(), opencl_unmap_frame(), output_single_frame(), output_video_frame(), overlay_ass_image(), overlay_cuda_blend(), overlay_opencl_blend(), overlay_vaapi_blend(), pack_yuv(), pam_encode_frame(), pcx_decode_frame(), photocd_decode_frame(), pick_color16(), pick_color8(), pixelize_slice(), plot_spectrum_column(), pnm_decode_frame(), pnm_encode_frame(), pp_filter_frame(), prepare_frame(), prepare_impulse(), print_long_term(), print_short_term(), process(), process_16(), process_frame(), process_planar(), process_planar_16(), process_slice(), ptx_decode_frame(), put_blocks(), put_lines_bits(), put_lines_bytes(), qoi_decode_frame(), qoi_encode_frame(), qsv_dynamic_pool_alloc(), qtrle_encode_line(), query_frame(), queue_frame(), rdft_horizontal16(), rdft_horizontal8(), remap_opencl_process_frame(), render_slice(), request_frame(), rpza_encode_stream(), run_test(), sbc_encode_frame(), scale_vt_filter_frame(), scalecuda_resize(), scroll_slice(), seqvideo_decode(), set_frame_data(), set_processing_window(), set_workpic_from_pic(), skip_check(), slice_get_derivative(), submit_frame(), sunrast_decode_frame(), super2xsai(), svc_decode_frame(), svq1_decode_frame(), svq1_encode_frame(), svq3_mc_dir_part(), targa_encode_frame(), targa_encode_normal(), targa_encode_rle(), threshold_slice(), thumbnail(), tm2_decode_blocks(), to_meta_with_crop(), tonemap(), tonemap_vaapi_filter_frame(), transpose_vt_filter_frame(), truemotion2rt_decode_frame(), try_push_frame(), txd_decode_frame(), uavs3d_output_callback(), uninit(), unpack_gray(), unpack_yuv(), update_histogram_diff(), update_sono_rgb(), update_sono_yuv(), utvideo_encode_frame(), v308_decode_frame(), v308_encode_frame(), v408_decode_frame(), v408_encode_frame(), v410_decode_slice(), v410_encode_frame(), vaapi_encode_issue(), vaapi_unmap_frame(), vble_restore_plane(), vcr1_decode_frame(), vectorscope16(), vectorscope8(), vertical_frame_pack(), vibrance_slice16(), vibrance_slice16p(), vibrance_slice8(), vibrance_slice8p(), video_decode(), video_decode_example(), video_get_buffer(), vk_set_descriptor_image(), vp56_render_mb(), vp8_lossy_decode_alpha(), vpx_decode(), vt_unmap(), vulkan_encode_init(), vulkan_transfer_frame(), wbmp_decode_frame(), weave_slice(), X264_frame(), xbm_decode_frame(), xbm_encode_frame(), xpm_decode_frame(), xvid_encode_frame(), xvid_encode_init(), xwd_decode_frame(), xwd_encode_frame(), y216_decode_frame(), y41p_decode_frame(), y41p_encode_frame(), yuv4_decode_frame(), yuv4_encode_frame(), zero12v_decode_frame(), and zerocodec_decode_frame().

◆ linesize

int AVFrame::linesize[AV_NUM_DATA_POINTERS]

For video, a positive or negative value, which is typically indicating the size in bytes of each picture line, but it can also be:

  • the negative byte size of lines for vertical flipping (with data[n] pointing to the end of the data
  • a positive or negative multiple of the byte size as for accessing even and odd fields of a frame (possibly flipped)

For audio, only linesize[0] may be set. For planar audio, each channel plane must be the same size.

For video the linesizes should be multiples of the CPUs alignment preference, this is 16 or 32 for modern desktop CPUs. Some code requires such alignment other code can be slower without correct alignment, for yet other it makes no difference.

Note
The linesize may be larger than the size of usable data – there may be extra padding present for performance reasons.
Attention
In case of video, line size values can be negative to achieve a vertically inverted iteration over image lines.
Examples
hw_decode.c, mux.c, and qsv_decode.c.

Definition at line 434 of file frame.h.

Referenced by alloc_base_frame(), alloc_picture(), aom_decode(), aom_encode(), apng_encode_frame(), apply_motion_generic(), averageiir2d(), avs_decode_frame(), avui_decode_frame(), avui_encode_frame(), bethsoftvid_decode_frame(), bilateralo_planes(), black_counter(), blend_frame_partial(), blockdetect_filter_frame(), blur(), blur_frame(), blur_planes(), blurdetect_filter_frame(), bmp_decode_frame(), bmp_encode_frame(), calc_avgy16(), calc_avgy8(), calc_diffs(), calculate_sums(), cas_slice16(), cas_slice8(), cdg_border_preset(), cdg_decode_flush(), cdg_decode_frame(), cdg_scroll(), cdg_tile_block(), cfhd_decode(), chroma_mc_bi(), cinvideo_decode_frame(), color_balance16(), color_balance16_p(), color_balance8(), color_balance8_p(), colormap_slice(), comp_block(), compare(), compare_fields(), compute_crc_of_packets(), compute_sat_hue_metrics16(), compute_sat_hue_metrics8(), config_output(), config_video_output(), conv_cuda_convert(), convert_frame(), convert_frame_partial(), copy_uv_planes(), cover_rect(), cri_decode_frame(), cuda_bilateral_process_internal(), cudachromakey_process_internal(), cuvid_output_frame(), deband_16_c(), deband_16_coupling_c(), deband_8_c(), deband_8_coupling_c(), decimate_frame(), decode_argb(), decode_argb_frame(), decode_argbi(), decode_argx(), decode_argxi(), decode_aybr(), decode_aybri(), decode_block(), decode_blocks(), decode_byry(), decode_byryi(), decode_c82i(), decode_c82p(), decode_ca2i(), decode_ca2p(), decode_ca4i(), decode_ca4p(), decode_frame(), decode_frame_common(), decode_idat_chunk(), decode_inter(), decode_inter_plane(), decode_packet(), decode_rgb(), decode_rgb24_frame(), decode_rgbi(), decode_rgbx(), decode_rgbxi(), decode_rle(), decode_rle16(), decode_rle_bpp2(), decode_rle_bpp4(), decode_slice(), decode_slice_thread(), decode_write(), decode_ybr(), decode_ybr10(), decode_ybr10i(), decode_ybri(), decode_ybyr(), decode_yry10(), decode_yry10i(), decode_yuv_frame(), deinterlace_plane_slice(), deinterlace_slice(), deshake_transform_c(), detect_scene_change(), dirac_decode_data_unit(), displace_packed(), displace_planar(), do_alphamerge(), do_denoise(), do_morpho(), do_vflip(), downscale(), draw_axis_rgb(), draw_axis_yuv(), draw_blank_frame(), draw_horiz_band(), draw_sono(), draw_spatial(), drawline(), drawtext(), dxtory_decode_v1_410(), dxtory_decode_v1_420(), dxtory_decode_v1_444(), dxtory_decode_v1_rgb(), encode(), encode_bitstream(), encode_frame(), encode_gbrp10(), encode_gbrp12(), encode_picture_ls(), encode_rgb48_10bit(), encode_slice(), epx2_slice(), epx3_slice(), escape130_decode_frame(), estimate_best_b_count(), eval_motion_dist(), exposure_slice(), extend_edges(), ff_aom_apply_film_grain(), ff_aom_image_copy_16_to_8(), ff_apply_vector_2x2(), ff_apply_vector_4x4(), ff_h263_decode_frame(), ff_h274_apply_film_grain(), ff_mpv_alloc_pic_accessories(), ff_sws_slice_worker(), ff_vp56_decode_mbs(), fill_picture(), fill_picture_monoblack(), fill_picture_rgb(), fill_yuv_image(), filter(), filter16_brng(), filter16_tout(), filter16_vrep(), filter8_brng(), filter8_tout(), filter8_vrep(), filter_1phase(), filter_frame(), filter_slice(), filter_slice_grey_edge(), filter_slice_packed(), filter_slice_planar(), filter_slice_rgba_packed(), filter_slice_rgba_planar(), find_min_max(), find_min_max_16(), find_min_max_planar(), find_min_max_planar_16(), fits_encode_frame(), flashsv2_encode_frame(), flip_bayer(), g2m_decode_frame(), gather_data_for_cel(), gather_data_for_subcel(), gem_decode_frame(), get_buffer(), get_input(), get_plane_buf(), get_scene_score(), get_zeropadded_input(), decklink_frame::GetBytes(), decklink_frame::GetFlags(), getpix(), decklink_frame::GetRowBytes(), gif_encode_frame(), gif_fill(), gif_fill_rect(), h264_frame_start(), handle_p_frame_apng(), handle_p_frame_png(), handle_small_bpp(), hdr_decode_frame(), hls_prediction_unit(), horizontal_frame_pack(), host_map_frame(), hqx_filter(), import_map(), init(), inject_frame(), inter_pred(), interleave_cols_to_any(), interp_lowres(), interpolate(), ir2_decode_frame(), is_frozen(), lag_decode_frame(), libx265_encode_frame(), limitdiff_slice(), load_input_picture(), load_palette(), lowpass16(), luma_abs_diff(), luma_mc_bi(), magy_decode_frame(), magy_decode_slice(), magy_decode_slice10(), maskedclamp_slice(), maskedminmax_slice(), mc_scaled(), mc_uni_scaled(), morpho_slice(), msp2_decode_frame(), msrle_decode_8_16_24_32(), msrle_decode_pal4(), multiply_slice(), mxpeg_check_dimensions(), nppscale_deinterleave(), nppscale_interleave(), nppscale_resize(), nppsharpen_sharpen(), npptranspose_rotate(), npptranspose_transpose(), output_single_frame(), output_video_frame(), overlay_ass_image(), overlay_cuda_blend(), pack_yuv(), pam_encode_frame(), pcx_decode_frame(), photocd_decode_frame(), pick_color16(), pick_color8(), pixelize_slice(), plot_spectrum_column(), pnm_decode_frame(), pnm_encode_frame(), pp_filter_frame(), prepare_impulse(), process(), process_16(), process_frame(), process_planar(), process_planar_16(), process_slice(), ptx_decode_frame(), put_blocks(), put_lines_bits(), put_lines_bytes(), qoi_decode_frame(), qoi_encode_frame(), qtrle_encode_line(), rdft_horizontal16(), rdft_horizontal8(), request_frame(), rpza_encode_stream(), run_test(), scalecuda_resize(), scroll_slice(), seq_decode_op1(), seq_decode_op2(), seq_decode_op3(), seqvideo_decode(), set_frame(), set_frame_data(), set_processing_window(), set_workpic_from_pic(), skip_check(), slice_get_derivative(), submit_frame(), sunrast_decode_frame(), super2xsai(), svc_decode_frame(), svq1_decode_frame(), svq1_encode_frame(), targa_encode_normal(), targa_encode_rle(), threshold_slice(), thumbnail(), tm2_decode_blocks(), to_meta_with_crop(), tonemap(), truemotion2rt_decode_frame(), try_push_frame(), txd_decode_frame(), uavs3d_output_callback(), unpack_gray(), unpack_yuv(), update_histogram_diff(), update_sono_rgb(), update_sono_yuv(), utvideo_encode_frame(), v308_decode_frame(), v308_encode_frame(), v408_decode_frame(), v408_encode_frame(), v410_decode_slice(), v410_encode_frame(), vble_restore_plane(), vcr1_decode_frame(), vectorscope16(), vectorscope8(), vertical_frame_pack(), vibrance_slice16(), vibrance_slice16p(), vibrance_slice8(), vibrance_slice8p(), video_decode(), video_decode_example(), video_get_buffer(), video_image_display(), vp8_lossy_decode_alpha(), vpx_decode(), wbmp_decode_frame(), weave_slice(), X264_frame(), xbm_decode_frame(), xbm_encode_frame(), xpm_decode_frame(), xvid_encode_frame(), xwd_decode_frame(), xwd_encode_frame(), y216_decode_frame(), y41p_decode_frame(), y41p_encode_frame(), yuv4_decode_frame(), yuv4_encode_frame(), zero12v_decode_frame(), and zerocodec_decode_frame().

◆ extended_data

uint8_t** AVFrame::extended_data

pointers to the data planes/channels.

For video, this should simply point to data[].

For planar audio, each channel has a separate data pointer, and linesize[0] contains the size of each channel buffer. For packed audio, there is just one data pointer, and linesize[0] contains the total size of the buffer for all channels.

Note: Both data and extended_data should always be set in a valid frame, but for planar audio with more channels that can fit in data, extended_data must be used in order to access all channels.

Examples
transcode_aac.c.

Definition at line 450 of file frame.h.

Referenced by activate(), amplify_channel(), audio_decode_frame(), celt_frame_setup_input(), channelmap_filter_frame(), compand_delay(), compand_drain(), compand_nodelay(), config_filter(), connect_ports(), drc_channel(), fft_channel(), filter_channel(), filter_channel_dbl(), filter_channels(), filter_frame(), fir_quantum(), flush_frame(), frame_configure_elements(), mcompand_channel(), move_audio(), output_audio_frame(), output_frame(), plot_freqs(), psy_channel(), push_frame(), read_decode_convert_and_store(), reverse_samples(), rnnoise_channels(), run_channel_cwt_prepare(), run_channel_fft(), sample_noise_block(), send_silence(), sofalizer_convolute(), sofalizer_fast_convolute(), spatial_activate(), step_collect_psy_metrics(), take_samples(), try_push_frame(), vb_stereo(), and video_get_buffer().

◆ width

int AVFrame::width
Examples
hw_decode.c, qsv_decode.c, and vaapi_encode.c.

Definition at line 461 of file frame.h.

Referenced by activate(), alloc_base_frame(), alloc_picture(), aom_decode(), aom_encode(), apng_encode_frame(), apply_color_indexing_transform(), apply_palette(), bidirectional_obmc(), bilateral_obmc(), black_counter(), blend_frame(), blur(), calc_diffs(), cdg_border_preset(), cfhd_decode(), compare(), config_input(), conv_cuda_convert(), convert(), convert_frame_partial(), copy_uv_planes(), cover_rect(), cuda_bilateral_process_internal(), cudachromakey_process_internal(), cudaupload_filter_frame(), cuvid_output_frame(), dec_open(), decklink_write_video_packet(), decode_frame_common(), decode_packet(), decode_write(), deint_vaapi_filter_frame(), do_alphamerge(), do_blend(), do_denoise(), downscale(), draw_axis_rgb(), draw_axis_yuv(), drawtext(), encode_apng(), encode_frame(), epx2_slice(), epx3_slice(), exposure_slice(), extend_edges(), ff_dnn_fill_gettingoutput_task(), ff_h274_apply_film_grain(), ff_libwebp_get_frame(), ff_mjpeg_decode_sos(), ff_vaapi_vpp_init_params(), fill_model_input_tf(), fill_model_input_th(), filter(), filter16_brng(), filter16_tout(), filter16_vrep(), filter8_brng(), filter8_tout(), filter8_vrep(), filter_1phase(), filter_frame(), filter_frame_ref(), filter_slice(), filter_slice_packed(), filter_slice_planar(), find_min_max(), find_min_max_16(), find_min_max_planar(), find_min_max_planar_16(), format_init(), get_output_ov(), get_output_tf(), get_output_th(), get_plane_buf(), get_scene_score(), getpix(), getpix_integrate(), gif_fill(), graphs_build(), h264_field_start(), handle_p_frame_apng(), horizontal_frame_pack(), host_map_frame(), hqx_filter(), import_map(), infer_completion_callback(), init(), init_filter(), init_stage(), inter_pred(), interpolate(), ist_filter_add(), load_palette(), lowpass16(), luma_abs_diff(), main(), misc_vaapi_filter_frame(), nppscale_filter_frame_ref(), nppscale_scale(), nppsharpen_sharpen(), nvdec_av1_start_frame(), nvdec_mjpeg_start_frame(), nvdec_mpeg12_start_frame(), nvdec_mpeg4_start_frame(), nvdec_vc1_start_frame(), nvdec_vp8_start_frame(), nvdec_vp9_start_frame(), output_single_frame(), output_video_frame(), overlay_ass_image(), overlay_cuda_blend(), overlay_vaapi_blend(), overlay_vulkan_blend(), pixscope_filter_frame(), pp_filter_frame(), procamp_vaapi_filter_frame(), process(), process_16(), process_frame(), process_planar(), process_planar_16(), query_frame(), queue_frame(), queue_picture(), rpza_encode_frame(), scale_frame(), scale_vaapi_filter_frame(), scalecuda_resize(), scroll(), send_eof(), sender_thread(), set_frame_data(), set_processing_window(), submit_frame(), super2xsai(), thumbnail(), tonemap_vaapi_filter_frame(), transfer_data_alloc(), transpose_vaapi_filter_frame(), update_histogram_diff(), update_sono_rgb(), update_sono_yuv(), var_size_bmc(), vectorscope16(), vectorscope8(), vertical_frame_pack(), vk_av1_fill_pict(), vk_h264_fill_pict(), vk_h264_start_frame(), vk_hevc_fill_pict(), vk_hevc_start_frame(), vulkan_encode_issue(), vulkan_transfer_frame(), and X264_frame().

◆ height

int AVFrame::height
Examples
hw_decode.c, qsv_decode.c, and vaapi_encode.c.

Definition at line 461 of file frame.h.

Referenced by activate(), alloc_base_frame(), alloc_picture(), aom_decode(), aom_encode(), apng_encode_frame(), apply_palette(), bidirectional_obmc(), bilateral_obmc(), black_counter(), blend_frame(), blend_frame_partial(), blur(), calc_diffs(), cfhd_decode(), compare(), compute_correction(), config_input(), conv_cuda_convert(), convert(), convert_frame_partial(), copy_uv_planes(), cover_rect(), cuda_bilateral_process_internal(), cudachromakey_process_internal(), cudaupload_filter_frame(), cuvid_output_frame(), dec_open(), decklink_write_video_packet(), decode_frame_common(), decode_packet(), decode_write(), deint_vaapi_filter_frame(), do_alphamerge(), do_blend(), do_denoise(), downscale(), draw_axis_rgb(), draw_axis_yuv(), draw_sono(), drawbox_vaapi_filter_frame(), drawtext(), encode_apng(), encode_frame(), epx2_slice(), epx3_slice(), exposure_slice(), extend_edges(), ff_dnn_fill_gettingoutput_task(), ff_h263_decode_frame(), ff_h274_apply_film_grain(), ff_libwebp_get_frame(), ff_mjpeg_decode_sos(), ff_vaapi_vpp_init_params(), fill_model_input_tf(), fill_model_input_th(), filter(), filter16_brng(), filter16_tout(), filter16_vrep(), filter8_brng(), filter8_tout(), filter8_vrep(), filter_1phase(), filter_frame(), filter_frame_ref(), filter_slice(), filter_slice_packed(), filter_slice_planar(), find_min_max(), find_min_max_16(), find_min_max_planar(), find_min_max_planar_16(), format_init(), get_output_ov(), get_output_tf(), get_output_th(), get_plane_buf(), get_scene_score(), decklink_frame::GetBytes(), getpix(), getpix_integrate(), gif_fill(), h264_field_start(), horizontal_frame_pack(), host_map_frame(), hqx_filter(), import_map(), infer_completion_callback(), init(), init_filter(), init_stage(), inter_pred(), interpolate(), ist_filter_add(), load_palette(), lowpass16(), luma_abs_diff(), main(), misc_vaapi_filter_frame(), nppscale_filter_frame_ref(), nppscale_scale(), nppsharpen_sharpen(), nvdec_av1_start_frame(), nvdec_mjpeg_start_frame(), nvdec_mpeg12_start_frame(), nvdec_mpeg4_start_frame(), nvdec_vc1_start_frame(), nvdec_vp8_start_frame(), nvdec_vp9_start_frame(), output_single_frame(), output_video_frame(), overlay_ass_image(), overlay_cuda_blend(), overlay_vaapi_blend(), overlay_vulkan_blend(), pixscope_filter_frame(), pp_filter_frame(), procamp_vaapi_filter_frame(), process(), process_16(), process_frame(), process_planar(), process_planar_16(), query_frame(), queue_frame(), queue_picture(), rpza_encode_frame(), scale_frame(), scale_vaapi_filter_frame(), scalecuda_resize(), scroll(), send_eof(), sender_thread(), set_frame_data(), set_processing_window(), submit_frame(), super2xsai(), thumbnail(), tonemap_slice(), tonemap_vaapi_filter_frame(), transfer_data_alloc(), transpose_vaapi_filter_frame(), update_histogram_diff(), var_size_bmc(), vectorscope16(), vectorscope8(), vertical_frame_pack(), vk_av1_fill_pict(), vk_h264_fill_pict(), vk_h264_start_frame(), vk_hevc_fill_pict(), vk_hevc_start_frame(), vulkan_encode_issue(), vulkan_transfer_frame(), and X264_frame().

◆ nb_samples

int AVFrame::nb_samples

◆ format

int AVFrame::format

format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio)

Examples
hw_decode.c, and vaapi_encode.c.

Definition at line 476 of file frame.h.

Referenced by activate(), alloc_base_frame(), alloc_picture(), aom_encode(), apng_encode_frame(), audio_decode_frame(), avfilter_link(), bmp_decode_frame(), celt_frame_setup_input(), clear_unused_frames(), config_filter(), config_input(), config_output(), config_props(), copy_uv_planes(), create_filtergraph(), cuvid_output_frame(), d3d11va_transfer_data(), d3d12va_transfer_data(), dec_open(), decode_frame_common(), decode_write(), deint_vaapi_filter_frame(), do_vflip(), downscale(), encode_apng(), encode_frame(), ff_aom_apply_film_grain(), ff_aom_image_copy_16_to_8(), ff_default_get_audio_buffer(), ff_default_get_video_buffer2(), ff_filter_frame(), ff_h263_decode_frame(), ff_h274_apply_film_grain(), ff_libwebp_get_frame(), ff_mjpeg_decode_sos(), fill_frameinfo_by_link(), filter_1phase(), filter_frame(), filter_frame_ref(), flip_bayer(), flush_frame(), get_plane_buf(), h264_field_start(), handle_p_frame_png(), have_alpha_planar(), horizontal_frame_pack(), host_map_frame(), init(), ist_filter_add(), jpeg2000_decode_tile(), main(), misc_vaapi_filter_frame(), nppscale_filter_frame_ref(), nppscale_scale(), output_audio_frame(), output_frame(), output_single_frame(), output_video_frame(), overlay_vaapi_blend(), pick_format(), print_digraph(), print_link_prop(), procamp_vaapi_filter_frame(), process_frame(), push_frame(), queue_picture(), rpza_encode_frame(), run_test(), scale_frame(), scale_vaapi_filter_frame(), send_eof(), sender_thread(), sofalizer_convolute(), sofalizer_fast_convolute(), submit_frame(), take_samples(), tiff_unpack_strip(), tonemap_vaapi_filter_frame(), transfer_data_alloc(), transpose_vaapi_filter_frame(), update_sono_yuv(), vertical_frame_pack(), vulkan_transfer_frame(), and X264_frame().

◆ key_frame

attribute_deprecated int AVFrame::key_frame

1 -> keyframe, 0-> not

Deprecated:
Use AV_FRAME_FLAG_KEY instead

Definition at line 485 of file frame.h.

◆ pict_type

enum AVPictureType AVFrame::pict_type

◆ sample_aspect_ratio

AVRational AVFrame::sample_aspect_ratio

◆ pts

int64_t AVFrame::pts

Presentation timestamp in time_base units (time when frame should be shown to user).

Examples
transcode.c.

Definition at line 501 of file frame.h.

Referenced by a64multi_encode_frame(), activate(), alloc_base_frame(), compand_delay(), compute_crc_of_packets(), decoder_thread(), deint_vaapi_filter_frame(), dnn_classify_flush_frame(), dnn_detect_flush_frame(), do_blend(), draw_spatial(), encode_frame(), encode_write_frame(), ff_framesync_dualinput_get(), ff_qsvvpp_filter_frame(), ff_rate_estimate_qscale(), ff_yadif_filter_frame(), ff_yadif_request_frame(), ffmal_copy_frame(), ffmmal_add_packet(), ffmmal_fill_input_port(), fg_output_frame(), filter_frame(), filter_frame_ref(), filter_slice(), filter_thread(), fir_frame(), flush_frame(), geq_filter_frame(), get_best_frame(), handle_input(), headphone_frame(), interpolate(), libuavs3d_decode_frame(), libx265_encode_frame(), load_input_picture(), main(), mediacodec_buffer_release(), mediacodec_wrap_hw_buffer(), misc_vaapi_filter_frame(), nppscale_filter_frame_ref(), nppscale_scale(), output_audio_frame(), output_frame(), output_single_frame(), overlay_cuda_blend(), overlay_vaapi_blend(), plot_spectrum_column(), procamp_vaapi_filter_frame(), process_frame(), push_frame(), push_samples(), request_frame(), return_frame(), scale_frame(), scale_vaapi_filter_frame(), send_frame(), send_silence(), spatial_activate(), submit_frame(), svc_decode_frame(), tonemap_vaapi_filter_frame(), transpose_vaapi_filter_frame(), try_push_frame(), uavs3d_output_callback(), update(), update_mono_detection(), update_out_phase_detection(), video_decode_example(), video_sync_process(), xfade_activate(), and xfade_opencl_activate().

◆ pkt_dts

int64_t AVFrame::pkt_dts

DTS copied from the AVPacket that triggered returning this frame.

(if frame threading isn't used) This is also the Presentation time of this AVFrame calculated from only AVPacket.dts values without pts values.

Definition at line 508 of file frame.h.

Referenced by svc_decode_frame(), uavs3d_output_callback(), and video_decode_example().

◆ time_base

AVRational AVFrame::time_base

Time base for the timestamps in this frame.

In the future, this field may be set on frames output by decoders or filters, but its value will be by default ignored on input to encoders or filters.

Examples
transcode.c.

Definition at line 516 of file frame.h.

Referenced by config_output(), config_props(), dec_open(), decoder_thread(), encode_write_frame(), evaluate_timeline_at_frame(), ff_filter_config_links(), ff_filter_frame(), ff_inlink_process_commands(), filter_frame(), filter_frame_ref(), filter_thread(), nppscale_filter_frame_ref(), nppscale_scale(), print_digraph(), request_frame_to_filter(), scale_frame(), send_eof(), take_samples(), update_link_current_pts(), and update_pts().

◆ quality

int AVFrame::quality

quality (between 1 (good) and FF_LAMBDA_MAX (bad))

Definition at line 521 of file frame.h.

Referenced by encode_frame(), filter_1phase(), ratecontrol_1pass(), svq1_encode_frame(), and xvid_encode_frame().

◆ opaque

void* AVFrame::opaque

Frame owner's private data.

This field may be set by the code that allocates/owns the frame data. It is then not touched by any library functions, except:

See also
opaque_ref the reference-counted analogue

Definition at line 537 of file frame.h.

Referenced by decoder_thread(), fg_send_command(), filter_thread(), handle_input(), libx265_encode_frame(), list_add_frame(), list_remove_head(), map_frame(), output_frame(), and progress_frame_pool_init_cb().

◆ repeat_pict

int AVFrame::repeat_pict

Number of fields in this frame which should be repeated, i.e.

the total duration of this frame should be repeat_pict + 2 normal field durations.

For interlaced frames this field may be set to 1, which signals that this frame should be presented as 3 fields: beginning with the first field (as determined by AV_FRAME_FLAG_TOP_FIELD_FIRST being set or not), followed by the second field, and then the first field again.

For progressive frames this field may be set to a multiple of 2, which signals that this frame's duration should be (repeat_pict + 2) / 2 normal frame durations.

Note
This field is computed from MPEG2 repeat_first_field flag and its associated flags, H.264 pic_struct from picture timing SEI, and their analogues in other codecs. Typically it should only be used when higher-layer timing information is not available.

Definition at line 557 of file frame.h.

Referenced by ff_yadif_filter_frame(), filter_frame(), and submit_frame().

◆ interlaced_frame

attribute_deprecated int AVFrame::interlaced_frame

The content of the picture is interlaced.

Deprecated:
Use AV_FRAME_FLAG_INTERLACED instead

Definition at line 566 of file frame.h.

Referenced by ff_yadif_filter_frame(), filter(), filter_frame(), query_frame(), and return_frame().

◆ top_field_first

attribute_deprecated int AVFrame::top_field_first

If the content is interlaced, is top field displayed first.

Deprecated:
Use AV_FRAME_FLAG_TOP_FIELD_FIRST instead

Definition at line 574 of file frame.h.

Referenced by filter(), and filter_frame().

◆ palette_has_changed

attribute_deprecated int AVFrame::palette_has_changed

Tell user application that palette has changed from previous frame.

Definition at line 582 of file frame.h.

Referenced by cdg_load_palette(), cinvideo_decode_frame(), decode_frame(), gem_decode_frame(), and seqvideo_decode().

◆ sample_rate

int AVFrame::sample_rate

◆ buf

AVBuffer references backing the data for this frame.

All the pointers in data and extended_data must point inside one of the buffers in buf or extended_buf. This array must be filled contiguously – if buf[i] is non-NULL then buf[j] must also be non-NULL for all j < i.

There may be at most one AVBuffer per data plane, so for video this array always contains all the references. For planar audio with more than AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in this array. Then the extra AVBufferRef pointers are stored in the extended_buf array.

Definition at line 602 of file frame.h.

Referenced by avcodec_send_frame(), avcodec_send_packet(), ddagrab_request_frame(), ff_decode_content_light_new_ext(), ff_decode_mastering_display_new_ext(), ff_decode_receive_frame(), ff_encode_get_frame(), ff_encode_receive_frame(), ff_frame_new_side_data_from_buf(), ff_frame_new_side_data_from_buf_ext(), ff_h264_build_ref_list(), ff_h264_unref_picture(), ff_vk_decode_frame(), fg_output_frame(), fg_send_command(), filter_thread(), fix_sub_duration_heartbeat(), flashsv_encode_frame(), frame_context_setup(), h264_decode_frame(), h264_initialise_ref_list(), h264_slice_init(), process_subtitle(), video_get_buffer(), vpx_decode(), and wait_delayed_frame().

◆ extended_buf

AVBufferRef** AVFrame::extended_buf

For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf.

Note that this is different from AVFrame.extended_data, which always contains all the pointers. This array only contains the extra pointers, which cannot fit into AVFrame.buf.

This array is always allocated using av_malloc() by whoever constructs the frame. It is freed in av_frame_unref().

Definition at line 616 of file frame.h.

◆ nb_extended_buf

int AVFrame::nb_extended_buf

Number of elements in extended_buf.

Definition at line 620 of file frame.h.

◆ side_data

AVFrameSideData** AVFrame::side_data

Definition at line 622 of file frame.h.

Referenced by filter_frame(), and libx265_encode_frame().

◆ nb_side_data

int AVFrame::nb_side_data

Definition at line 623 of file frame.h.

Referenced by filter_frame(), and libx265_encode_frame().

◆ flags

int AVFrame::flags

◆ color_range

enum AVColorRange AVFrame::color_range

◆ color_primaries

enum AVColorPrimaries AVFrame::color_primaries

◆ color_trc

enum AVColorTransferCharacteristic AVFrame::color_trc

◆ colorspace

enum AVColorSpace AVFrame::colorspace

◆ chroma_location

enum AVChromaLocation AVFrame::chroma_location

Definition at line 681 of file frame.h.

Referenced by format_init(), and vaapi_vpp_colour_properties().

◆ best_effort_timestamp

int64_t AVFrame::best_effort_timestamp

frame timestamp estimated using various heuristics, in stream time base

  • encoding: unused
  • decoding: set by libavcodec, read by user.
Examples
transcode.c.

Definition at line 688 of file frame.h.

Referenced by main().

◆ pkt_pos

attribute_deprecated int64_t AVFrame::pkt_pos

reordered pos from the last AVPacket that has been input into the decoder

  • encoding: unused
  • decoding: Read by user.
    Deprecated:
    use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user data from packets to frames

Definition at line 699 of file frame.h.

Referenced by do_blend(), filter_frame(), filter_frame_ref(), nppscale_filter_frame_ref(), nppscale_scale(), overlay_cuda_blend(), scale_frame(), and uavs3d_output_callback().

◆ metadata

AVDictionary* AVFrame::metadata

◆ decode_error_flags

int AVFrame::decode_error_flags

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.

Definition at line 716 of file frame.h.

◆ pkt_size

attribute_deprecated int AVFrame::pkt_size

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.
    Deprecated:
    use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user data from packets to frames

Definition at line 733 of file frame.h.

Referenced by uavs3d_output_callback().

◆ hw_frames_ctx

AVBufferRef* AVFrame::hw_frames_ctx

◆ opaque_ref

AVBufferRef* AVFrame::opaque_ref

Frame owner's private data.

This field may be set by the code that allocates/owns the frame data. It is then not touched by any library functions, except:

See also
opaque the plain pointer analogue

Definition at line 756 of file frame.h.

Referenced by libx265_encode_frame().

◆ crop_top

size_t AVFrame::crop_top

Definition at line 766 of file frame.h.

Referenced by alloc_base_frame(), ff_vaapi_vpp_init_params(), h264_frame_start(), and init_filter().

◆ crop_bottom

size_t AVFrame::crop_bottom

Definition at line 767 of file frame.h.

Referenced by alloc_base_frame(), ff_vaapi_vpp_init_params(), h264_frame_start(), and init_filter().

◆ crop_left

size_t AVFrame::crop_left

Definition at line 768 of file frame.h.

Referenced by alloc_base_frame(), ff_vaapi_vpp_init_params(), h264_frame_start(), and init_filter().

◆ crop_right

size_t AVFrame::crop_right

Definition at line 769 of file frame.h.

Referenced by alloc_base_frame(), ff_vaapi_vpp_init_params(), h264_frame_start(), and init_filter().

◆ private_ref

AVBufferRef* AVFrame::private_ref

AVBufferRef for internal use by a single libav* library.

Must not be used to transfer data between libraries. Has to be NULL when ownership of the frame leaves the respective library.

Code outside the FFmpeg libs should never check or change 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 private_ref field.

Definition at line 785 of file frame.h.

Referenced by nvdec_av1_start_frame(), nvdec_mjpeg_start_frame(), nvdec_mpeg12_start_frame(), nvdec_mpeg4_start_frame(), nvdec_vc1_start_frame(), nvdec_vp8_start_frame(), and nvdec_vp9_start_frame().

◆ ch_layout

AVChannelLayout AVFrame::ch_layout

◆ duration

int64_t AVFrame::duration

The documentation for this struct was generated from the following file: