FFmpeg
Loading...
Searching...
No Matches
Data Fields
AVFormatContext Struct Reference

Format I/O context. More...

#include <avformat.h>

Data Fields

const AVClassav_class
  A class for logging and AVOptions.
 
const struct AVInputFormatiformat
  The input container format.
 
const struct AVOutputFormatoformat
  The output container format.
 
void *  priv_data
  Format private data.
 
  I/O context.
 
int  ctx_flags
  Flags signalling stream properties.
 
unsigned int  nb_streams
  Number of elements in AVFormatContext.streams.
 
  A list of all streams in the file.
 
unsigned int  nb_stream_groups
  Number of elements in AVFormatContext.stream_groups.
 
  A list of all stream groups in the file.
 
unsigned int  nb_chapters
  Number of chapters in AVChapter array.
 
 
char *  url
  input or output URL.
 
  Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
 
  Duration of the stream, in AV_TIME_BASE fractional seconds.
 
  Total stream bitrate in bit/s, 0 if not available.
 
unsigned int  packet_size
 
int  max_delay
 
int  flags
  Flags modifying the (de)muxer behaviour.
 
  Maximum number of bytes read from input in order to determine stream properties.
 
  Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().
 
const uint8_t *  key
 
int  keylen
 
unsigned int  nb_programs
 
 
  Forced video codec_id.
 
  Forced audio codec_id.
 
  Forced subtitle codec_id.
 
  Forced Data codec_id.
 
  Metadata that applies to the whole file.
 
  Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January 1970).
 
  The number of frames used for determining the framerate in avformat_find_stream_info().
 
  Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors.
 
  Custom interrupt callbacks for the I/O layer.
 
int  debug
  Flags to enable debugging.
 
int  max_streams
  The maximum number of streams.
 
unsigned int  max_index_size
  Maximum amount of memory in bytes to use for the index of each stream.
 
unsigned int  max_picture_buffer
  Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices.
 
  Maximum buffering duration for interleaving.
 
int  max_ts_probe
  Maximum number of packets to read while waiting for the first timestamp.
 
  Max chunk time in microseconds.
 
  Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it is used when not supported.
 
  Maximum number of packets that can be probed.
 
  Allow non-standard and experimental extension.
 
int  event_flags
  Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.
 
  Avoid negative timestamps during muxing.
 
  Audio preload in microseconds.
 
  forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presence of B frames.
 
  Skip duration calculation in estimate_timings_from_pts.
 
int  avio_flags
  avio flags, used to force AVIO_FLAG_DIRECT.
 
  The duration field can be estimated through various ways, and this field can be used to know how the duration was estimated.
 
  Skip initial bytes when opening stream.
 
unsigned int  correct_ts_overflow
  Correct single timestamp overflows.
 
int  seek2any
  Force seeking to any (also non key) frames.
 
  Flush the I/O context after each packet.
 
int  probe_score
  format probing score.
 
  Maximum number of bytes read from input in order to identify the input format.
 
char *  codec_whitelist
  ',' separated list of allowed decoders.
 
char *  format_whitelist
  ',' separated list of allowed demuxers.
 
  ',' separated list of allowed protocols.
 
  ',' separated list of disallowed protocols.
 
  IO repositioned flag.
 
const struct AVCodecvideo_codec
  Forced video codec.
 
const struct AVCodecaudio_codec
  Forced audio codec.
 
const struct AVCodecsubtitle_codec
  Forced subtitle codec.
 
const struct AVCodecdata_codec
  Forced data codec.
 
  Number of bytes to be written as padding in a metadata header.
 
void *  opaque
  User data.
 
  Callback used by devices to communicate with application.
 
  Output timestamp offset, in microseconds.
 
uint8_t *  dump_separator
  dump format separator.
 
int(*  io_open )(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
  A callback for opening new IO streams.
 
int(*  io_close2 )(struct AVFormatContext *s, AVIOContext *pb)
  A callback for closing the streams opened with AVFormatContext.io_open().
 
  Maximum number of bytes read from input in order to determine stream durations when using estimate_timings_from_pts in avformat_find_stream_info().
 
char *  name
  Name of this format context, only used for logging purposes.
 
  Depth recursion limit,.
 

Detailed Description

Format I/O context.

New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVFormatContext) must not be used outside libav*, use avformat_alloc_context() to create an AVFormatContext.

Fields can be accessed through AVOptions (av_opt*), the name string used matches the associated command line parameter name and can be found in libavformat/options_table.h. The AVOption/command line parameter names differ in some cases from the C structure field names for historic reasons or brevity.

Examples
avio_read_callback.c, decode_filter_audio.c, decode_filter_video.c, demux_decode.c, extract_mvs.c, hw_decode.c, mux.c, qsv_decode.c, qsv_transcode.c, remux.c, show_metadata.c, transcode.c, transcode_aac.c, and vaapi_transcode.c.

Definition at line 1333 of file avformat.h.

Field Documentation

◆  av_class

const AVClass* AVFormatContext::av_class

A class for logging and AVOptions.

Set by avformat_alloc_context(). Exports (de)muxer private options if they exist.

Definition at line 1338 of file avformat.h.

◆  iformat

const struct AVInputFormat* AVFormatContext::iformat

The input container format.

Demuxing only, set by avformat_open_input().

Definition at line 1345 of file avformat.h.

Referenced by assert_file_overwrite(), av_dump_format(), avformat_find_stream_info(), dump_stream_format(), dump_stream_group(), estimate_timings(), ff_img_read_header(), hls_read_packet(), ifile_open(), ist_use(), parse_playlist(), read_thread(), and ts_discontinuity_detect().

◆  oformat

const struct AVOutputFormat* AVFormatContext::oformat

The output container format.

Muxing only, must be set by the caller before avformat_write_header().

Examples
mux.c.

Definition at line 1352 of file avformat.h.

Referenced by add_stream(), av_dump_format(), create_rtp_muxer(), create_streams(), dash_check_bitstream(), dump_stream_format(), dump_stream_group(), ff_rtp_chain_mux_open(), ff_rtp_get_payload_type(), hls_mux_init(), hls_start(), hls_write_packet(), log_slave(), main(), map_auto_audio(), map_auto_data(), map_auto_subtitle(), map_auto_video(), mpegts_init(), mux_fixup_ts(), new_stream_video(), of_open(), ost_add(), print_sdp(), print_streams(), rtp_mpegts_write_header(), seg_check_bitstream(), seg_write_packet(), segment_mux_init(), segment_start(), streamcopy_init(), and thread_set_name().

◆  priv_data

void* AVFormatContext::priv_data

Format private data.

This is an AVOptions-enabled struct if and only if iformat/oformat.priv_class is not NULL.

Definition at line 1361 of file avformat.h.

Referenced by add_display_matrix(), add_file(), add_video_stream(), android_camera_read_close(), android_camera_read_header(), android_camera_read_packet(), apng_write_header(), apng_write_packet(), apng_write_trailer(), at_write_header(), at_write_packet(), at_write_trailer(), audio_get_output_timestamp(), audio_read_close(), audio_read_close(), audio_read_close(), audio_read_header(), audio_read_header(), audio_read_header(), audio_read_header(), audio_read_packet(), audio_read_packet(), audio_read_packet(), audio_read_packet(), audio_write_frame(), audio_write_header(), audio_write_header(), audio_write_header(), audio_write_packet(), audio_write_packet(), audio_write_packet(), audio_write_trailer(), audio_write_trailer(), camera_dev_disconnected(), camera_dev_error(), cine_read_packet(), cine_read_seek(), close_slaves(), concat_parse_script(), concat_read_close(), concat_read_header(), concat_read_packet(), concat_seek(), create_capture_session(), create_image_reader(), create_subcc_packet(), create_subcc_streams(), dc1394_close(), decklink_select_input(), decklink_setup_audio(), decklink_setup_video(), decklink_write_audio_packet(), decklink_write_data_packet(), decklink_write_subtitle_packet(), decklink_write_video_packet(), detect_stream_specific(), dshow_add_device(), dshow_cycle_devices(), dshow_cycle_formats(), dshow_cycle_pins(), dshow_list_device_options(), dshow_open_device(), dshow_read_header(), dshow_set_audio_buffer_size(), dshow_should_set_format(), efi_read(), failing_deinit(), fbdev_read_close(), fbdev_read_header(), fbdev_read_packet(), ff_alsa_close(), ff_alsa_xrun_recover(), ff_decklink_cleanup(), ff_decklink_init_device(), ff_decklink_list_formats(), ff_decklink_read_close(), ff_decklink_read_header(), ff_decklink_read_packet(), ff_decklink_set_configs(), ff_decklink_set_format(), ff_decklink_write_header(), ff_decklink_write_trailer(), ff_dshow_try_setup_crossbar_options(), ff_img_read_header(), ff_img_read_packet(), ff_oss_audio_open(), ff_rtp_get_payload_type(), ff_rtp_send_aac(), ff_rtp_send_amr(), ff_rtp_send_data(), ff_rtp_send_h263(), ff_rtp_send_h263_rfc2190(), ff_rtp_send_h264_hevc(), ff_rtp_send_jpeg(), ff_rtp_send_latm(), ff_rtp_send_mpegvideo(), ff_rtp_send_raw_rfc4175(), ff_rtp_send_vp8(), ff_rtp_send_xiph(), ff_sndio_open(), fifo_consumer_thread(), fifo_deinit(), fifo_init(), fifo_mux_init(), fifo_test_header(), fifo_test_packet(), fifo_test_trailer(), fifo_thread_attempt_recovery(), fifo_thread_flush_output(), fifo_thread_process_recovery_failure(), fifo_thread_recover(), fifo_thread_write_header(), fifo_thread_write_packet(), fifo_thread_write_trailer(), fifo_write_header(), fifo_write_packet(), fifo_write_trailer(), film_deinit(), film_init(), film_write_header(), film_write_packet(), flush_buffered(), flush_packet(), frm_read_packet(), gdigrab_read_close(), gdigrab_read_header(), gdigrab_read_packet(), get_current_fragment(), get_image_format(), get_metadata(), get_packet_lj92(), get_sensor_orientation(), hls_start(), hls_write_packet(), iec61883_close(), iec61883_read_header(), iec61883_read_packet(), image_available(), img_read_close(), init_subtitle_context(), kmsgrab_get_fb(), kmsgrab_read_close(), kmsgrab_read_header(), kmsgrab_read_packet(), lavfi_read_close(), lavfi_read_header(), lavfi_read_packet(), match_framerate(), match_streams(), match_streams_exact_id(), match_streams_one_to_one(), match_video_size(), mcc_init(), mcc_write_header(), mcc_write_packet(), mv_read_header(), mv_read_packet(), mv_read_seek(), nal_send(), open_camera(), open_file(), open_next_file(), opus_header(), opus_packet(), parse_audio_var(), parse_device_name(), parse_global_var(), rcwt_flush_cluster(), rcwt_read_header(), rcwt_write_header(), rcwt_write_packet(), read_data(), read_data_continuous(), read_data_subtitle_segment(), read_header(), read_header(), read_packet(), read_packet(), read_seek(), read_subtitle_packet(), real_seek(), rtcp_send_sr(), rtp_deinit(), rtp_send_ilbc(), rtp_send_mpegaudio(), rtp_send_mpegts_raw(), rtp_send_raw(), rtp_send_samples(), rtp_write_header(), rtp_write_packet(), rtp_write_trailer(), sbg_read_header(), scan_file(), scc_write_header(), scc_write_packet(), segment_start(), send_mode_a(), send_mode_b(), setup_crossbar_options(), srt_write_header(), srt_write_packet(), start_jack(), tedcaptions_read_close(), tedcaptions_read_header(), tedcaptions_read_packet(), tedcaptions_read_seek(), tee_process_slave_failure(), tee_write_header(), tee_write_packet(), tee_write_trailer(), try_seek(), update_init_section(), update_init_section(), wait_for_image_format(), write_header(), write_headers(), write_packet(), write_streamheader(), and write_trailer().

◆  pb

AVIOContext* AVFormatContext::pb

I/O context.

Do NOT set this field if AVFMT_NOFILE flag is set in iformat/oformat.flags. In such a case, the (de)muxer will handle I/O in some other way and this field will be NULL.

Examples
mux.c.

Definition at line 1375 of file avformat.h.

Referenced by apng_write_header(), apng_write_trailer(), asfrtp_parse_packet(), avformat_find_stream_info(), avi_read_close(), chunk_end(), chunk_start(), cine_read_header(), cine_read_packet(), cine_read_seek(), close_demux_for_component(), close_slave(), concat_parse_script(), create_rtp_muxer(), dash_flush(), dash_free(), dash_write_packet(), efi_read(), estimate_timings(), estimate_timings_from_bit_rate(), estimate_timings_from_pts(), event_loop(), ff_img_read_header(), ff_img_read_packet(), ff_mov_add_hinted_packet(), ff_mov_close_hinting(), ff_mov_generate_squashed_ttml_packet(), ff_rtp_chain_mux_open(), ff_rtp_send_data(), ff_rtsp_tcp_write_packet(), ff_rtsp_undo_setup(), ff_sauce_read(), ff_wms_parse_sdp_a_line(), fifo_thread_write_trailer(), film_write_packet(), flush_dynbuf(), flush_packet(), free_playlist_list(), free_representation(), frm_read_header(), frm_read_packet(), hds_flush(), hds_free(), hds_write_header(), hls_mux_init(), hls_read_header(), hls_start(), hls_write_packet(), hls_write_trailer(), init_subtitle_context(), ism_flush(), ism_free(), LLVMFuzzerTestOneInput(), main(), mcc_write_header(), mcc_write_packet(), microdvd_write_packet(), mpegts_write_packet_internal(), mv_read_header(), mv_read_packet(), mv_read_seek(), mxf_parse_handle_essence(), mxf_read_local_tags(), mxf_seek_to_previous_partition(), of_open(), parse_audio_var(), parse_global_var(), parse_playlist(), parse_video_var(), rcwt_flush_cluster(), rcwt_read_header(), rcwt_write_header(), rdt_parse_packet(), read_gab2_sub(), read_header(), read_header(), read_packet(), read_seek(), read_table(), read_thread(), reopen_demux_for_component(), rtcp_send_sr(), rtp_mpegts_write_close(), rtp_mpegts_write_header(), rtp_mpegts_write_packet(), rtp_write_header(), rtp_write_trailer(), sap_read_header(), sap_write_close(), sbg_read_header(), scc_write_header(), scc_write_packet(), seg_free(), seg_init(), seg_write_header(), seg_write_packet(), seg_write_trailer(), segment_end(), segment_start(), srt_write_packet(), tedcaptions_read_header(), update_stream_timings(), var_read_metadata(), webm_chunk_deinit(), webm_chunk_init(), webm_chunk_write_header(), webm_chunk_write_packet(), webm_chunk_write_trailer(), whip_deinit(), write_header(), and write_muxed_file().

◆  ctx_flags

int AVFormatContext::ctx_flags

Flags signalling stream properties.

A combination of AVFMTCTX_*. Set by libavformat.

Definition at line 1382 of file avformat.h.

Referenced by avformat_find_stream_info(), ff_img_read_header(), handle_packet(), hls_read_header(), hls_read_packet(), sap_read_header(), and tb_unreliable().

◆  nb_streams

unsigned int AVFormatContext::nb_streams

Number of elements in AVFormatContext.streams.

Set by avformat_new_stream(), must not be modified by any other code.

Examples
mux.c, and qsv_decode.c.

Definition at line 1389 of file avformat.h.

Referenced by add_stream(), asfrtp_parse_sdp_line(), at_write_header(), audio_write_header(), av_dump_format(), av_find_best_stream(), av_program_add_stream_index2(), avformat_find_stream_info(), close_slave(), concat_parse_script(), concat_read_header(), copy_meta(), copy_metadata(), create_stream_groups(), create_streams(), create_subcc_streams(), dash_read_header(), detect_bdmv_dovi_group(), ds_open(), estimate_timings(), estimate_timings_from_bit_rate(), estimate_timings_from_pts(), ff_decklink_write_header(), ff_nut_reset_ts(), ff_rdt_parse_open(), ff_rfps_calculate(), fifo_consumer_thread(), fifo_mux_init(), fifo_thread_write_header(), fill_all_stream_timings(), film_init(), find_stream(), handle_id3(), has_duration(), hds_write_header(), hls_read_header(), hls_read_packet(), hls_read_seek(), id3_has_changed_values(), ifile_open(), log_slave(), main(), match_streams(), match_streams_exact_id(), match_streams_one_to_one(), mcc_init(), movie_common_init(), mv_read_packet(), mv_read_seek(), mxf_compute_index_tables(), mxf_parse_structural_metadata(), of_add_metadata(), of_parse_group_token(), open_demux_for_component(), open_slave(), open_track_resource_context(), probe_file(), read_gab2_sub(), read_packet(), read_thread(), real_seek(), reopen_demux_for_component(), rtp_write_header(), sap_fetch_packet(), sap_read_header(), seg_init(), set_disposition_bits(), setup_sync_queues(), stream_component_close(), stream_component_open(), tee_write_header(), update_stream_timings(), update_streams_from_subdemuxer(), write_header(), write_headers(), write_index(), and write_mainheader().

◆  streams

AVStream** AVFormatContext::streams

A list of all streams in the file.

New streams are created with avformat_new_stream().

Freed by libavformat in avformat_free_context().

Examples
hw_decode.c, and qsv_decode.c.

Definition at line 1401 of file avformat.h.

Referenced by apng_write_header(), asfrtp_parse_packet(), asfrtp_parse_sdp_line(), at_write_header(), audio_write_frame(), audio_write_header(), audio_write_header(), audio_write_header(), av_find_best_stream(), avformat_find_stream_info(), cine_read_packet(), copy_meta(), copy_metadata(), create_rtp_muxer(), create_stream_groups(), create_subcc_streams(), dash_check_bitstream(), dash_read_packet(), decklink_write_audio_packet(), decklink_write_video_packet(), detect_bdmv_dovi_group(), ds_open(), dump_stream_format(), estimate_timings(), estimate_timings_from_bit_rate(), estimate_timings_from_pts(), ff_decklink_write_header(), ff_decklink_write_packet(), ff_img_read_packet(), ff_load_image(), ff_mov_init_hinting(), ff_rdt_parse_open(), ff_rfps_calculate(), ff_rtp_chain_mux_open(), ff_rtp_send_aac(), ff_rtp_send_amr(), ff_rtp_send_jpeg(), ff_rtp_send_latm(), ff_rtp_send_raw_rfc4175(), ff_rtp_send_xiph(), ff_sauce_read(), fifo_consumer_thread(), fifo_mux_init(), fifo_thread_attempt_recovery(), fifo_thread_write_header(), fifo_thread_write_packet(), fill_all_stream_timings(), fill_timing_for_id3_timestamped_stream(), film_init(), film_write_header(), film_write_packet(), find_stream(), flush_buffered(), flush_packet(), frm_read_packet(), get_private_data(), get_timebase(), has_duration(), hds_write_header(), hls_read_header(), hls_read_packet(), hls_read_seek(), hls_write_header(), id3_has_changed_values(), ifile_open(), imf_read_packet(), lavfi_read_header(), lavfi_read_packet(), log_slave(), main(), main(), match_streams_exact_id(), match_streams_one_to_one(), mcc_init(), mov_read_chapters(), mov_write_ttml_document_from_queue(), movie_common_init(), mpegts_push_data(), mpegts_write_packet_internal(), mv_read_packet(), mv_read_seek(), mxf_compute_index_tables(), mxf_parse_structural_metadata(), mxf_set_audio_pts(), nal_send(), next_duration(), of_add_metadata(), of_parse_group_token(), open_demux_for_component(), open_slave(), open_track_resource_context(), opus_header(), opus_packet(), output_segment_list(), pmt_cb(), probe_file(), rcwt_write_header(), read_gab2_sub(), read_packet(), read_thread(), real_seek(), reopen_demux_for_component(), report_new_stream(), rtcp_send_sr(), rtp_mpegts_write_header(), rtp_mpegts_write_packet(), rtp_send_ilbc(), rtp_write_header(), rtp_write_packet(), sap_fetch_packet(), sap_read_header(), sap_write_header(), sbg_read_packet(), sbg_read_seek2(), scc_write_header(), seg_check_bitstream(), seg_init(), set_disposition_bits(), srt_write_header(), stream_component_close(), stream_component_open(), tee_write_packet(), update_stream_extradata(), update_stream_timings(), update_streams_from_subdemuxer(), webm_chunk_write_header(), write_header(), write_headers(), and write_hls_media_playlist().

◆  nb_stream_groups

unsigned int AVFormatContext::nb_stream_groups

Number of elements in AVFormatContext.stream_groups.

Set by avformat_stream_group_create(), must not be modified by any other code.

Definition at line 1408 of file avformat.h.

Referenced by av_dump_format(), avformat_find_stream_info(), create_stream_groups(), dump_stream_group(), get_stream_group_index_from_id(), ifile_open(), of_parse_group_token(), of_parse_iamf_submixes(), and open_demux_for_component().

◆  stream_groups

AVStreamGroup** AVFormatContext::stream_groups

A list of all stream groups in the file.

New groups are created with avformat_stream_group_create(), and filled with avformat_stream_group_add_stream().

Freed by libavformat in avformat_free_context().

Definition at line 1420 of file avformat.h.

Referenced by avformat_find_stream_info(), create_stream_groups(), dump_stream_group(), get_stream_group_index_from_id(), ifile_open(), of_parse_group_token(), of_parse_iamf_submixes(), and open_demux_for_component().

◆  nb_chapters

unsigned int AVFormatContext::nb_chapters

Number of chapters in AVChapter array.

When muxing, chapters are normally written in the file header, so nb_chapters should normally be initialized before write_header is called. Some muxers (e.g. mov and mkv) can also write chapters in the trailer. To write chapters in the trailer, nb_chapters must be zero when write_header is called and non-zero when write_trailer is called.

  • muxing: set by user
  • demuxing: set by libavformat

Definition at line 1433 of file avformat.h.

Referenced by av_dump_format(), copy_chapters(), event_loop(), of_add_metadata(), ogm_chapter(), parse_forced_key_frames(), and write_headers().

◆  chapters

AVChapter** AVFormatContext::chapters

Definition at line 1434 of file avformat.h.

Referenced by av_dump_format(), copy_chapters(), of_add_metadata(), ogm_chapter(), parse_forced_key_frames(), and write_chapter().

◆  url

char* AVFormatContext::url

input or output URL.

Unlike the old filename field, this field has no length restriction.

Freed by libavformat in avformat_free_context().

Definition at line 1449 of file avformat.h.

Referenced by add_file(), append_single_file(), assert_file_overwrite(), at_write_header(), audio_read_header(), audio_read_header(), audio_write_header(), audio_write_header(), create_streams(), decklink_setup_video(), fbdev_read_header(), ff_decklink_list_formats(), ff_decklink_read_header(), ff_decklink_write_header(), ff_img_read_header(), ff_img_read_packet(), ff_rtsp_setup_output_streams(), fifo_init(), fifo_thread_write_header(), gdigrab_read_header(), hls_append_segment(), hls_delete_old_segments(), hls_mux_init(), hls_rename_temp_file(), hls_start(), hls_write_packet(), hls_write_trailer(), iec61883_read_header(), lavfi_read_header(), log_slave(), map_auto_audio(), map_auto_data(), map_auto_video(), of_open(), parse_device_name(), read_header(), seg_init(), seg_write_header(), seg_write_packet(), segment_end(), segment_start(), set_segment_filename(), sls_flag_file_rename(), sls_flag_use_localtime_filename(), sls_flags_filename_process(), start_jack(), tee_write_header(), webm_chunk_init(), and write_header().

◆  start_time

int64_t AVFormatContext::start_time

Position of the first frame of the component, in AV_TIME_BASE fractional seconds.

NEVER set this value directly: It is deduced from the AVStream values.

Demuxing only, set by libavformat.

Definition at line 1458 of file avformat.h.

Referenced by av_dump_format(), estimate_timings(), event_loop(), fill_all_stream_timings(), ifile_open(), ist_filter_add(), movie_common_init(), read_thread(), rewind_file(), and update_stream_timings().

◆  duration

int64_t AVFormatContext::duration

Duration of the stream, in AV_TIME_BASE fractional seconds.

Only set this value if you know none of the individual stream durations and also do not set any of them. This is deduced from the AVStream values if not set.

Demuxing only, set by libavformat.

Definition at line 1468 of file avformat.h.

Referenced by av_dump_format(), concat_read_header(), estimate_timings(), estimate_timings_from_bit_rate(), event_loop(), fill_all_stream_timings(), get_best_effort_duration(), has_duration(), ifile_open(), of_open(), process_command(), and update_stream_timings().

◆  bit_rate

int64_t AVFormatContext::bit_rate

Total stream bitrate in bit/s, 0 if not available.

Never set it directly if the file_size and the duration are known as FFmpeg can compute it automatically.

Definition at line 1475 of file avformat.h.

Referenced by av_dump_format(), estimate_timings(), estimate_timings_from_bit_rate(), event_loop(), and update_stream_timings().

◆  packet_size

unsigned int AVFormatContext::packet_size

Definition at line 1477 of file avformat.h.

Referenced by rtp_write_header().

◆  max_delay

int AVFormatContext::max_delay

Definition at line 1478 of file avformat.h.

Referenced by create_rtp_muxer(), ff_rtp_chain_mux_open(), ff_rtp_send_aac(), ff_rtp_send_amr(), ff_rtp_send_xiph(), fifo_mux_init(), hls_mux_init(), of_open(), rtp_mpegts_write_header(), rtp_send_ilbc(), sap_read_header(), segment_mux_init(), and webm_chunk_init().

◆  flags

int AVFormatContext::flags

Flags modifying the (de)muxer behaviour.

A combination of AVFMT_FLAG_*. Set by the user before avformat_open_input() / avformat_write_header().

Definition at line 1484 of file avformat.h.

Referenced by android_camera_read_packet(), avformat_find_stream_info(), create_rtp_muxer(), fbdev_read_header(), fbdev_read_packet(), ff_img_read_header(), ff_rtp_chain_mux_open(), fifo_mux_init(), gdigrab_read_packet(), hls_mux_init(), hls_read_header(), ifile_open(), main(), mcc_write_header(), mov_write_isml_manifest(), of_open(), open_file(), open_slave(), open_track_resource_context(), read_thread(), reopen_demux_for_component(), rtp_write_header(), segment_mux_init(), webm_chunk_init(), and write_header().

◆  probesize

int64_t AVFormatContext::probesize

Maximum number of bytes read from input in order to determine stream properties.

Used when reading the global header and in avformat_find_stream_info().

Demuxing only, set by the caller before avformat_open_input().

Note
this is not used for determining the input format
See also
format_probesize

Definition at line 1532 of file avformat.h.

Referenced by avformat_find_stream_info(), hls_read_header(), lavfi_read_header(), and reopen_demux_for_component().

◆  max_analyze_duration

int64_t AVFormatContext::max_analyze_duration

Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().

Demuxing only, set by the caller before avformat_find_stream_info(). Can be set to 0 to let avformat choose using a heuristic.

Definition at line 1540 of file avformat.h.

Referenced by avformat_find_stream_info(), hls_read_header(), and reopen_demux_for_component().

◆  key

const uint8_t* AVFormatContext::key

Definition at line 1542 of file avformat.h.

◆  keylen

int AVFormatContext::keylen

Definition at line 1543 of file avformat.h.

◆  nb_programs

unsigned int AVFormatContext::nb_programs

Definition at line 1545 of file avformat.h.

Referenced by av_dump_format(), av_find_program_from_stream(), av_new_program(), av_program_add_stream_index2(), clear_avprogram(), discard_pid(), discard_unused_programs(), of_add_metadata(), open_slave(), pat_cb(), and update_stream_timings().

◆  programs

AVProgram** AVFormatContext::programs

Definition at line 1546 of file avformat.h.

Referenced by av_dump_format(), av_find_program_from_stream(), av_new_program(), av_program_add_stream_index2(), clear_avprogram(), discard_pid(), discard_unused_programs(), of_add_metadata(), open_slave(), pat_cb(), and update_stream_timings().

◆  video_codec_id

enum AVCodecID AVFormatContext::video_codec_id

Forced video codec_id.

Demuxing: Set by user.

Definition at line 1552 of file avformat.h.

Referenced by dshow_read_header(), ff_img_read_header(), and ifile_open().

◆  audio_codec_id

enum AVCodecID AVFormatContext::audio_codec_id

Forced audio codec_id.

Demuxing: Set by user.

Definition at line 1558 of file avformat.h.

Referenced by audio_read_header(), ff_img_read_header(), and ifile_open().

◆  subtitle_codec_id

enum AVCodecID AVFormatContext::subtitle_codec_id

Forced subtitle codec_id.

Demuxing: Set by user.

Definition at line 1564 of file avformat.h.

Referenced by ifile_open().

◆  data_codec_id

enum AVCodecID AVFormatContext::data_codec_id

Forced Data codec_id.

Demuxing: Set by user.

Definition at line 1570 of file avformat.h.

Referenced by ifile_open().

◆  metadata

AVDictionary* AVFormatContext::metadata

Metadata that applies to the whole file.

Freed by libavformat in avformat_free_context().

Definition at line 1580 of file avformat.h.

Referenced by av_dump_format(), copy_meta(), ff_sauce_read(), ff_wms_parse_sdp_a_line(), fifo_mux_init(), handle_id3(), hls_mux_init(), hls_read_header(), hls_read_packet(), mxf_parse_structural_metadata(), of_add_metadata(), open_slave(), read_header(), read_string(), read_thread(), read_uint16(), read_uint32(), read_uint64(), read_uint8(), rtp_mpegts_write_header(), scan_file(), segment_mux_init(), var_read_metadata(), and webm_chunk_init().

◆  start_time_realtime

int64_t AVFormatContext::start_time_realtime

Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January 1970).

That is, pts=0 in the stream was captured at this real world time.

  • muxing: Set by the caller before avformat_write_header(). If set to either 0 or AV_NOPTS_VALUE, then the current wall-time will be used.
  • demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that the value may become known after some number of frames have been received.

Definition at line 1593 of file avformat.h.

Referenced by apply_sync_offsets(), create_rtp_muxer(), ff_rtp_chain_mux_open(), and rtp_write_header().

◆  fps_probe_size

int AVFormatContext::fps_probe_size

The number of frames used for determining the framerate in avformat_find_stream_info().

Demuxing only, set by the caller before avformat_find_stream_info().

Definition at line 1600 of file avformat.h.

Referenced by avformat_find_stream_info().

◆  error_recognition

int AVFormatContext::error_recognition

Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors.

Demuxing only, set by the caller before avformat_open_input().

Definition at line 1607 of file avformat.h.

Referenced by mov_read_packet().

◆  interrupt_callback

AVIOInterruptCB AVFormatContext::interrupt_callback

Custom interrupt callbacks for the I/O layer.

demuxing: set by the user before avformat_open_input(). muxing: set by the user before avformat_write_header() (mainly useful for AVFMT_NOFILE formats). The callback should also be passed to avio_open2() if it's used to open the file.

Definition at line 1618 of file avformat.h.

Referenced by avformat_find_stream_info(), create_rtp_muxer(), ff_rtp_chain_mux_open(), fifo_mux_init(), fifo_test_packet(), hls_mux_init(), hls_read_header(), ifile_open(), ism_seek(), lavfi_read_header(), LLVMFuzzerTestOneInput(), of_open(), open_file(), open_slave(), read_thread(), reopen_demux_for_component(), sap_read_header(), segment_mux_init(), and webm_chunk_init().

◆  debug

int AVFormatContext::debug

Flags to enable debugging.

Definition at line 1623 of file avformat.h.

◆  max_streams

int AVFormatContext::max_streams

The maximum number of streams.

  • encoding: unused
  • decoding: set by user

Definition at line 1636 of file avformat.h.

◆  max_index_size

unsigned int AVFormatContext::max_index_size

Maximum amount of memory in bytes to use for the index of each stream.

If the index exceeds this size, entries will be discarded as needed to maintain a smaller size. This can lead to slower or less accurate seeking (depends on demuxer). Demuxers for which a full in-memory index is mandatory will ignore this.

  • muxing: unused
  • demuxing: set by user

Definition at line 1648 of file avformat.h.

◆  max_picture_buffer

unsigned int AVFormatContext::max_picture_buffer

Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices.

Definition at line 1654 of file avformat.h.

◆  max_interleave_delta

int64_t AVFormatContext::max_interleave_delta

Maximum buffering duration for interleaving.

To ensure all the streams are interleaved correctly, av_interleaved_write_frame() will wait until it has at least one packet for each stream before actually writing any packets to the output file. When some streams are "sparse" (i.e. there are large gaps between successive packets), this can result in excessive buffering.

This field specifies the maximum difference between the timestamps of the first and the last packet in the muxing queue, above which libavformat will output a packet regardless of whether it has queued a packet for all the streams.

Muxing only, set by the caller before avformat_write_header().

Definition at line 1672 of file avformat.h.

◆  max_ts_probe

int AVFormatContext::max_ts_probe

Maximum number of packets to read while waiting for the first timestamp.

Decoding only.

Definition at line 1678 of file avformat.h.

Referenced by avformat_find_stream_info().

◆  max_chunk_duration

int AVFormatContext::max_chunk_duration

Max chunk time in microseconds.

Note, not all formats support this and unpredictable things may happen if it is used when not supported.

  • encoding: Set by user
  • decoding: unused

Definition at line 1686 of file avformat.h.

◆  max_chunk_size

int AVFormatContext::max_chunk_size

Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it is used when not supported.

  • encoding: Set by user
  • decoding: unused

Definition at line 1694 of file avformat.h.

◆  max_probe_packets

int AVFormatContext::max_probe_packets

Maximum number of packets that can be probed.

  • encoding: unused
  • decoding: set by user

Definition at line 1701 of file avformat.h.

◆  strict_std_compliance

int AVFormatContext::strict_std_compliance

Allow non-standard and experimental extension.

See also
AVCodecContext.strict_std_compliance

Definition at line 1707 of file avformat.h.

Referenced by create_rtp_muxer(), ff_rtp_chain_mux_open(), hls_mux_init(), mov_write_video_tag(), open_slave(), rtp_write_header(), and webm_chunk_init().

◆  event_flags

int AVFormatContext::event_flags

Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.

Definition at line 1720 of file avformat.h.

Referenced by hls_read_packet(), and read_thread().

◆  avoid_negative_ts

int AVFormatContext::avoid_negative_ts

Avoid negative timestamps during muxing.

Any value of the AVFMT_AVOID_NEG_TS_* constants. Note, this works better when using av_interleaved_write_frame().

  • muxing: Set by user
  • demuxing: unused

Definition at line 1737 of file avformat.h.

Referenced by seg_init(), and webm_chunk_init().

◆  audio_preload

int AVFormatContext::audio_preload

Audio preload in microseconds.

Note, not all formats support this and unpredictable things may happen if it is used when not supported.

  • encoding: Set by user
  • decoding: unused

Definition at line 1749 of file avformat.h.

◆  use_wallclock_as_timestamps

int AVFormatContext::use_wallclock_as_timestamps

forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presence of B frames.

  • encoding: unused
  • decoding: Set by user

Definition at line 1757 of file avformat.h.

◆  skip_estimate_duration_from_pts

int AVFormatContext::skip_estimate_duration_from_pts

Skip duration calculation in estimate_timings_from_pts.

  • encoding: unused
  • decoding: set by user
See also
duration_probesize

Definition at line 1766 of file avformat.h.

Referenced by estimate_timings_from_pts().

◆  avio_flags

int AVFormatContext::avio_flags

avio flags, used to force AVIO_FLAG_DIRECT.

  • encoding: unused
  • decoding: Set by user

Definition at line 1773 of file avformat.h.

◆  duration_estimation_method

enum AVDurationEstimationMethod AVFormatContext::duration_estimation_method

The duration field can be estimated through various ways, and this field can be used to know how the duration was estimated.

  • encoding: unused
  • decoding: Read by user

Definition at line 1781 of file avformat.h.

Referenced by estimate_timings().

◆  skip_initial_bytes

int64_t AVFormatContext::skip_initial_bytes

Skip initial bytes when opening stream.

  • encoding: unused
  • decoding: Set by user

Definition at line 1788 of file avformat.h.

◆  correct_ts_overflow

unsigned int AVFormatContext::correct_ts_overflow

Correct single timestamp overflows.

  • encoding: unused
  • decoding: Set by user

Definition at line 1795 of file avformat.h.

◆  seek2any

int AVFormatContext::seek2any

Force seeking to any (also non key) frames.

  • encoding: unused
  • decoding: Set by user

Definition at line 1802 of file avformat.h.

◆  flush_packets

int AVFormatContext::flush_packets

Flush the I/O context after each packet.

  • encoding: Set by user
  • decoding: unused

Definition at line 1809 of file avformat.h.

Referenced by webm_chunk_init().

◆  probe_score

int AVFormatContext::probe_score

format probing score.

The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes the format.

  • encoding: unused
  • decoding: set by avformat, read by user

Definition at line 1818 of file avformat.h.

◆  format_probesize

int AVFormatContext::format_probesize

Maximum number of bytes read from input in order to identify the input format.

Only used when the format is not set explicitly by the caller.

Demuxing only, set by the caller before avformat_open_input().

See also
probesize

Definition at line 1829 of file avformat.h.

◆  codec_whitelist

char* AVFormatContext::codec_whitelist

',' separated list of allowed decoders.

If NULL then all are allowed

  • encoding: unused
  • decoding: set by user

Definition at line 1837 of file avformat.h.

Referenced by avformat_find_stream_info().

◆  format_whitelist

char* AVFormatContext::format_whitelist

',' separated list of allowed demuxers.

If NULL then all are allowed

  • encoding: unused
  • decoding: set by user

Definition at line 1845 of file avformat.h.

◆  protocol_whitelist

char* AVFormatContext::protocol_whitelist

',' separated list of allowed protocols.

  • encoding: unused
  • decoding: set by user

Definition at line 1852 of file avformat.h.

Referenced by ism_seek(), and lavfi_read_header().

◆  protocol_blacklist

char* AVFormatContext::protocol_blacklist

',' separated list of disallowed protocols.

  • encoding: unused
  • decoding: set by user

Definition at line 1859 of file avformat.h.

Referenced by ism_seek().

◆  io_repositioned

int AVFormatContext::io_repositioned

IO repositioned flag.

This is set by avformat when the underlying IO context read pointer is repositioned, for example when doing byte based seeking. Demuxers can use the flag to detect such changes.

Definition at line 1867 of file avformat.h.

◆  video_codec

const struct AVCodec* AVFormatContext::video_codec

Forced video codec.

This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

Definition at line 1875 of file avformat.h.

Referenced by ifile_open().

◆  audio_codec

const struct AVCodec* AVFormatContext::audio_codec

Forced audio codec.

This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

Definition at line 1883 of file avformat.h.

Referenced by ifile_open().

◆  subtitle_codec

const struct AVCodec* AVFormatContext::subtitle_codec

Forced subtitle codec.

This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

Definition at line 1891 of file avformat.h.

Referenced by ifile_open().

◆  data_codec

const struct AVCodec* AVFormatContext::data_codec

Forced data codec.

This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

Definition at line 1899 of file avformat.h.

Referenced by ifile_open().

◆  metadata_header_padding

int AVFormatContext::metadata_header_padding

Number of bytes to be written as padding in a metadata header.

Demuxing: Unused. Muxing: Set by user.

Definition at line 1906 of file avformat.h.

◆  opaque

void* AVFormatContext::opaque

User data.

This is a place for some private data of the user.

Definition at line 1912 of file avformat.h.

Referenced by fifo_mux_init(), hls_mux_init(), open_slave(), open_track_resource_context(), and segment_mux_init().

◆  control_message_cb

av_format_control_message AVFormatContext::control_message_cb

Callback used by devices to communicate with application.

Definition at line 1917 of file avformat.h.

◆  output_ts_offset

int64_t AVFormatContext::output_ts_offset

Output timestamp offset, in microseconds.

Muxing: set by user

Definition at line 1923 of file avformat.h.

◆  dump_separator

uint8_t* AVFormatContext::dump_separator

dump format separator.

can be ", " or "\n " or anything else

  • muxing: Set by user.
  • demuxing: Set by user.

Definition at line 1931 of file avformat.h.

Referenced by dump_stream_format(), and dump_stream_group().

◆  io_open

int(* AVFormatContext::io_open) (struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)

A callback for opening new IO streams.

Whenever a muxer or a demuxer needs to open an IO stream (typically from avformat_open_input() for demuxers, but for certain formats can happen at other times as well), it will call this callback to obtain an IO context.

Parameters
s the format context
pb on success, the newly opened IO context should be returned here
url the url to open
flags a combination of AVIO_FLAG_*
options a dictionary of additional options, with the same semantics as in avio_open2()
Returns
0 on success, a negative AVERROR code on failure
Note
Certain muxers and demuxers do nesting, i.e. they open one or more additional internal format contexts. Thus the AVFormatContext pointer passed to this callback may be different from the one facing the caller. It will, however, have the same 'opaque' field.

Definition at line 1953 of file avformat.h.

Referenced by ff_img_read_packet(), fifo_mux_init(), hls_mux_init(), hls_read_header(), init_subtitle_context(), open_slave(), open_track_resource_context(), read_header(), reopen_demux_for_component(), seg_write_header(), and segment_mux_init().

◆  io_close2

int(* AVFormatContext::io_close2) (struct AVFormatContext *s, AVIOContext *pb)

A callback for closing the streams opened with AVFormatContext.io_open().

Parameters
s the format context
pb IO context to be closed and freed
Returns
0 on success, a negative AVERROR code on failure

Definition at line 1963 of file avformat.h.

Referenced by fifo_mux_init(), hls_mux_init(), open_slave(), open_track_resource_context(), and segment_mux_init().

◆  duration_probesize

int64_t AVFormatContext::duration_probesize

Maximum number of bytes read from input in order to determine stream durations when using estimate_timings_from_pts in avformat_find_stream_info().

Demuxing only, set by the caller before avformat_find_stream_info(). Can be set to 0 to let avformat choose using a heuristic.

See also
skip_estimate_duration_from_pts

Definition at line 1973 of file avformat.h.

Referenced by estimate_timings_from_pts().

◆  name

char* AVFormatContext::name

Name of this format context, only used for logging purposes.

Definition at line 1978 of file avformat.h.

Referenced by ifile_open().

◆  recursion_limit

int AVFormatContext::recursion_limit

Depth recursion limit,.

The maximum recursion depth that a Demuxer can open a Demuxer within itself.

  • demuxing: Set by user

Definition at line 1987 of file avformat.h.


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

Generated on Sun Sep 6 2026 19:21:24 for FFmpeg by doxygen 1.13.2

AltStyle によって変換されたページ (->オリジナル) /