FFmpeg
Functions
Core functions

Functions

unsigned avformat_version (void)
 Return the LIBAVFORMAT_VERSION_INT constant. More...
 
const char * avformat_configuration (void)
 Return the libavformat build-time configuration. More...
 
const char * avformat_license (void)
 Return the libavformat license. More...
 
int avformat_network_init (void)
 Do global initialization of network libraries. More...
 
int avformat_network_deinit (void)
 Undo the initialization done by avformat_network_init. More...
 
const AVOutputFormatav_muxer_iterate (void **opaque)
 Iterate over all registered muxers. More...
 
const AVInputFormatav_demuxer_iterate (void **opaque)
 Iterate over all registered demuxers. More...
 
AVFormatContextavformat_alloc_context (void)
 Allocate an AVFormatContext. More...
 
void avformat_free_context (AVFormatContext *s)
 Free an AVFormatContext and all its streams. More...
 
const AVClassavformat_get_class (void)
 Get the AVClass for AVFormatContext. More...
 
const AVClassav_stream_get_class (void)
 Get the AVClass for AVStream. More...
 
const AVClassav_stream_group_get_class (void)
 Get the AVClass for AVStreamGroup. More...
 
const char * avformat_stream_group_name (enum AVStreamGroupParamsType type)
 
AVStreamGroupavformat_stream_group_create (AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
 Add a new empty stream group to a media file. More...
 
AVStreamavformat_new_stream (AVFormatContext *s, const struct AVCodec *c)
 Add a new stream to a media file. More...
 
int avformat_stream_group_add_stream (AVStreamGroup *stg, AVStream *st)
 Add an already allocated stream to a stream group. More...
 
AVProgramav_new_program (AVFormatContext *s, int id)
 

Detailed Description

Functions for querying libavformat capabilities, allocating core structures, etc.

Function Documentation

◆ avformat_version()

unsigned avformat_version ( void  )

Return the LIBAVFORMAT_VERSION_INT constant.

Definition at line 30 of file version.c.

◆ avformat_configuration()

const char* avformat_configuration ( void  )

Return the libavformat build-time configuration.

Definition at line 36 of file version.c.

◆ avformat_license()

const char* avformat_license ( void  )

Return the libavformat license.

Definition at line 41 of file version.c.

◆ avformat_network_init()

int avformat_network_init ( void  )

Do global initialization of network libraries.

This is optional, and not recommended anymore.

This functions only exists to work around thread-safety issues with older GnuTLS or OpenSSL libraries. If libavformat is linked to newer versions of those libraries, or if you do not use them, calling this function is unnecessary. Otherwise, you need to call this function before any other threads using them are started.

This function will be deprecated once support for older GnuTLS and OpenSSL libraries is removed, and this function has no purpose anymore.

Examples
avio_http_serve_files.c, and avio_list_dir.c.

Definition at line 558 of file utils.c.

Referenced by main().

◆ avformat_network_deinit()

int avformat_network_deinit ( void  )

Undo the initialization done by avformat_network_init.

Call it only once for each time you called avformat_network_init.

Examples
avio_list_dir.c.

Definition at line 570 of file utils.c.

Referenced by do_exit(), ffmpeg_cleanup(), and main().

◆ av_muxer_iterate()

const AVOutputFormat* av_muxer_iterate ( void **  opaque)

Iterate over all registered muxers.

Parameters
opaquea pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered muxer or NULL when the iteration is finished

Definition at line 582 of file allformats.c.

Referenced by av_guess_format(), format_child_class_iterate(), show_format_opts(), and show_formats_devices().

◆ av_demuxer_iterate()

const AVInputFormat* av_demuxer_iterate ( void **  opaque)

Iterate over all registered demuxers.

Parameters
opaquea pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered demuxer or NULL when the iteration is finished

Definition at line 603 of file allformats.c.

Referenced by av_find_input_format(), av_probe_input_format3(), ff_img_read_header(), format_child_class_iterate(), LLVMFuzzerTestOneInput(), print_times(), probe(), show_format_opts(), and show_formats_devices().

◆ avformat_alloc_context()

AVFormatContext* avformat_alloc_context ( void  )

◆ avformat_free_context()

void avformat_free_context ( AVFormatContext s)

◆ avformat_get_class()

const AVClass* avformat_get_class ( void  )

Get the AVClass for AVFormatContext.

It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

See also
av_opt_find().

Definition at line 196 of file options.c.

Referenced by ifile_open(), opt_default(), show_format_opts(), show_help_default(), and validate_enc_avopt().

◆ av_stream_get_class()

const AVClass* av_stream_get_class ( void  )

Get the AVClass for AVStream.

It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

See also
av_opt_find().

Definition at line 244 of file options.c.

◆ av_stream_group_get_class()

const AVClass* av_stream_group_get_class ( void  )

Get the AVClass for AVStreamGroup.

It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

See also
av_opt_find().

Definition at line 416 of file options.c.

◆ avformat_stream_group_name()

const char* avformat_stream_group_name ( enum AVStreamGroupParamsType  type)
Returns
a string identifying the stream group type, or NULL if unknown

Definition at line 324 of file avformat.c.

Referenced by get_stream_group_type(), and show_stream_group().

◆ avformat_stream_group_create()

AVStreamGroup* avformat_stream_group_create ( AVFormatContext s,
enum AVStreamGroupParamsType  type,
AVDictionary **  options 
)

Add a new empty stream group to a media file.

When demuxing, it may be called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().

When muxing, may be called by the user before avformat_write_header().

User is required to call avformat_free_context() to clean up the allocation by avformat_stream_group_create().

New streams can be added to the group with avformat_stream_group_add_stream().

Parameters
smedia file handle
Returns
newly created group or NULL on error.
See also
avformat_new_stream, avformat_stream_group_add_stream.

Definition at line 421 of file options.c.

Referenced by iamf_read_header(), mov_parse_tiles(), mov_read_iacb(), and of_parse_group_token().

◆ avformat_new_stream()

AVStream* avformat_new_stream ( AVFormatContext s,
const struct AVCodec c 
)

Add a new stream to a media file.

When demuxing, it is called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().

When muxing, should be called by the user before avformat_write_header().

User is required to call avformat_free_context() to clean up the allocation by avformat_new_stream().

Parameters
smedia file handle
cunused, does nothing
Returns
newly created stream or NULL on error.
Examples
mux.c, qsv_transcode.c, remux.c, transcode.c, transcode_aac.c, and vaapi_transcode.c.

Referenced by aa_read_header(), aax_read_header(), ac4_read_header(), ace_read_header(), acm_read_header(), add_dstream(), add_stream(), add_video_stream(), adp_read_header(), ads_read_header(), adts_aac_read_header(), adx_read_header(), aea_read_header(), afc_read_header(), aiff_read_header(), aix_read_header(), apac_read_header(), apc_read_header(), ape_read_header(), ape_tag_read_field(), apng_read_header(), aptx_read_header_common(), aqt_read_header(), argo_brp_read_header(), asf_read_stream_properties(), ass_read_header(), ast_read_header(), audio_read_header(), av1_read_header(), avi_read_header(), avisynth_create_stream(), avr_read_header(), avs_read_packet(), bfi_read_header(), binka_read_header(), bmv_read_header(), bonk_read_header(), cdata_read_header(), cdxl_read_packet(), cin_read_header(), cine_read_header(), codec2_read_header(), codec2raw_read_header(), concat_parse_script(), create_audio_stream(), create_new_audio_stream(), create_stream(), create_subcc_streams(), dash_init(), dat_read_packet(), daud_header(), dc1394_read_common(), dcstr_read_header(), dec_enc(), decode_main_header(), derf_read_header(), dfa_read_header(), dfpwm_read_header(), dhav_read_packet(), dsf_read_header(), dshow_add_device(), dss_read_header(), dtshd_read_header(), dvdvideo_audio_stream_add(), dvdvideo_subp_stream_add(), dvdvideo_video_stream_add(), dxa_read_header(), ea_read_header(), eit_cb(), epaf_read_header(), evc_read_header(), fbdev_read_header(), ff_add_attached_pic(), ff_decklink_read_header(), ff_img_read_header(), ff_raw_audio_read_header(), ff_raw_subtitle_read_header(), ff_raw_video_read_header(), ff_rtp_chain_mux_open(), ff_spdif_read_packet(), ff_stream_clone(), film_read_header(), fits_read_header(), flac_read_header(), frm_read_header(), fsb_read_header(), fwse_read_header(), g722_read_header(), g723_1_init(), g726_read_header(), g729_read_header(), gdigrab_read_header(), gdv_read_header(), genh_read_header(), get_audio_config(), get_sindex(), get_video_config(), gif_read_header(), grab_read_header(), gsm_read_header(), hca_read_header(), hcom_read_header(), hds_write_header(), heif_add_stream(), hls_mux_init(), hnm_read_header(), iamf_read_header(), idcin_read_header(), iec61883_read_header(), iff_read_header(), ifv_read_header(), ilbc_read_header(), init_audio(), init_fps(), init_stream(), init_video_stream(), initialize_fifo_tst_muxer_chain(), ipmovie_read_header(), ipu_read_header(), ircam_read_header(), ism_write_header(), iss_read_header(), ivr_read_header(), jacosub_read_header(), jpegxl_anim_read_header(), kmsgrab_read_header(), laf_read_header(), lavfi_read_header(), lmlm4_read_header(), loas_read_header(), lrc_read_header(), lvf_read_header(), lxf_read_header(), main(), match_streams_one_to_one(), mcc_read_header(), microdvd_read_header(), mmf_read_header(), modplug_read_header(), mods_read_header(), moflex_read_sync(), mov_init_ttml_writer(), mov_read_iacb(), mov_read_trak(), mp3_read_header(), mpc8_read_header(), mpc_read_header(), mpegps_read_packet(), mpegts_init(), mpegts_push_data(), mpegts_read_header(), mpegts_set_stream_info(), mpjpeg_read_header(), mpl2_read_header(), mpsub_read_header(), msf_read_header(), msnwc_tcp_read_header(), msp_read_header(), mtaf_read_header(), mtv_read_header(), musx_read_header(), mv_read_header(), mxf_add_metadata_stream(), mxf_parse_structural_metadata(), mxg_read_header(), nc_read_header(), new_stream(), nist_read_header(), nsp_read_header(), nsv_parse_NSVs_header(), nuv_header(), ogg_new_stream(), oma_read_header(), open_demux_for_component(), open_output_file(), osq_read_header(), ost_add(), parse_chunk(), parse_strk(), parse_vtrk(), pcm_read_header(), pdv_read_header(), pjs_read_header(), pmp_header(), pmt_cb(), pp_bnk_read_header(), pulse_read_header(), pva_read_header(), pvf_read_header(), qcp_read_header(), qoa_read_header(), r3d_read_red1(), r3d_read_reda(), raw_data_read_header(), rawvideo_read_header(), read_desc_chunk(), read_frame(), read_header(), read_header_gme(), read_header_openmpt(), read_header_vs(), read_packet(), realtext_read_header(), redspark_read_header(), rka_read_header(), rl2_read_header(), rm_read_header(), rm_read_header_old(), rm_read_multi(), roq_read_packet(), rpl_read_header(), rsd_read_header(), rso_read_header(), rtp_mpegts_write_header(), s337m_read_packet(), sami_read_header(), sap_fetch_packet(), sap_read_header(), sbg_read_header(), scc_read_header(), scd_read_track(), sdns_read_header(), sdr2_read_header(), sds_read_header(), sdx_read_header(), seq_read_header(), ser_read_header(), sga_audio_packet(), sga_video_packet(), siff_parse_vbv1(), simbiosis_imx_read_header(), smacker_read_header(), smjpeg_read_header(), smush_read_header(), sol_read_header(), sox_read_header(), srt_read_header(), stl_read_header(), str_read_packet(), subviewer1_read_header(), subviewer_read_header(), sup_read_header(), svag_read_header(), svs_read_header(), swf_read_packet(), tak_read_header(), tedcaptions_read_header(), thp_read_header(), threedostr_read_header(), tmv_read_header(), track_header(), tta_read_header(), txd_read_header(), ty_read_header(), update_streams_from_subdemuxer(), v4l2_read_header(), vag_read_header(), vc1t_read_header(), vfw_read_header(), vid_read_packet(), vivo_read_header(), vmd_read_header(), voc_read_packet(), vpk_read_header(), vplayer_read_header(), vqf_read_header(), wady_read_header(), wavarc_read_header(), wc3_read_header(), webvtt_read_header(), write_muxed_file(), wsaud_read_header(), wsd_read_header(), wsvqa_read_header(), wsvqa_read_packet(), wv_read_header(), wve_read_header(), xa_read_header(), xmd_read_header(), xmv_process_packet_header(), xvag_read_header(), xwma_read_header(), yop_read_header(), and yuv4_read_header().

◆ avformat_stream_group_add_stream()

int avformat_stream_group_add_stream ( AVStreamGroup stg,
AVStream st 
)

Add an already allocated stream to a stream group.

When demuxing, it may be called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().

When muxing, may be called by the user before avformat_write_header() after having allocated a new group with avformat_stream_group_create() and stream with avformat_new_stream().

User is required to call avformat_free_context() to clean up the allocation by avformat_stream_group_add_stream().

Parameters
stgstream group belonging to a media file.
ststream in the media file to add to the group.
Return values
0success
AVERROR(EEXIST)the stream was already in the group
another negative error codelegitimate errors
See also
avformat_new_stream, avformat_stream_group_create.

Definition at line 494 of file options.c.

Referenced by iamf_read_header(), mov_parse_tiles(), mov_read_iacb(), and of_parse_group_token().

◆ av_new_program()

AVProgram* av_new_program ( AVFormatContext s,
int  id 
)

Definition at line 334 of file avformat.c.

Referenced by dash_read_header(), hls_read_header(), of_add_programs(), pat_cb(), and sdt_cb().