Go to the documentation of this file.
19 #ifndef FFTOOLS_FFMPEG_H
20 #define FFTOOLS_FFMPEG_H
24 #include <stdatomic.h>
54 #define FFMPEG_OPT_QPHIST 1
55 #define FFMPEG_OPT_ADRIFT_THRESHOLD 1
56 #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
57 #define FFMPEG_OPT_TOP 1
58 #define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
59 #define FFMPEG_OPT_VSYNC_DROP 1
60 #define FFMPEG_OPT_VSYNC 1
61 #define FFMPEG_OPT_FILTER_SCRIPT 1
63 #define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
71 #if FFMPEG_OPT_VSYNC_DROP
230 #if FFMPEG_OPT_FILTER_SCRIPT
500 #define ABORT_ON_FLAG_EMPTY_OUTPUT (1 << 0)
501 #define ABORT_ON_FLAG_EMPTY_OUTPUT_STREAM (1 << 1)
544 #if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP
739 void *logctx,
int decode);
766 unsigned sched_idx_enc,
780 const char *
command,
const char *
arg,
int all_filters);
844 Scheduler *sch,
unsigned sch_idx,
void *log_parent);
const uint8_t * subtitle_header
int fg_create_simple(FilterGraph **pfg, InputStream *ist, char *graph_desc, Scheduler *sch, unsigned sched_idx_enc, const OutputFilterOptions *opts)
AVCodecParameters * par_enc
AVPixelFormat
Pixel format.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
struct FilterGraph * graph
SpecifierOptList force_fps
SpecifierOptList forced_key_frames
int ist_use(InputStream *ist, int decoding_needed, const ViewSpecifier *vs, SchedulerNode *src)
int view_specifier_parse(const char **pspec, ViewSpecifier *vs)
AVChannelLayout ch_layout
This struct describes the properties of an encoded stream.
@ DECODER_FLAG_SEND_END_TS
int enc_open(void *opaque, const AVFrame *frame)
void fg_free(FilterGraph **pfg)
float frame_drop_threshold
const AVRational * frame_rates
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src)
atomic_uint_least64_t packets_written
int dec_filter_add(Decoder *dec, InputFilter *ifilter, InputFilterOptions *opts, const ViewSpecifier *vs, SchedulerNode *src)
SpecifierOptList bits_per_raw_sample
SpecifierOptList audio_ch_layouts
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
int64_t start_time
start time in microseconds == AV_TIME_BASE units
AVIOContext * progress_avio
This structure describes decoded (raw) audio or video data.
@ DECODER_FLAG_FRAMERATE_FORCED
int64_t of_filesize(OutputFile *of)
SpecifierOptList display_hflips
const AVCodecParameters * par
SpecifierOptList passlogfiles
int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc, const OutputFilterOptions *opts)
enum HWAccelID hwaccel_id
const AVIOInterruptCB int_cb
int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
Create a new filtergraph in the global filtergraph list.
#define fc(width, name, range_min, range_max)
int hw_device_init_from_string(const char *arg, HWDevice **dev)
@ VIEW_SPECIFIER_TYPE_ALL
void enc_stats_write(OutputStream *ost, EncStats *es, const AVFrame *frame, const AVPacket *pkt, uint64_t frame_num)
@ IFILTER_FLAG_AUTOROTATE
unsigned int fix_sub_duration_heartbeat
int enc_loopback(Encoder *enc)
SpecifierOptList frame_pix_fmts
SpecifierOptList canvas_sizes
Callback for checking whether to abort blocking functions.
enum AVPixelFormat hwaccel_output_format
SpecifierOptList max_frame_rates
float dts_delta_threshold
@ FRAME_OPAQUE_SUB_HEARTBEAT
void opt_match_per_stream_int(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int *out)
SpecifierOptList enc_stats_pre_fmt
SpecifierOptList mux_stats_fmt
@ VIEW_SPECIFIER_TYPE_POS
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
void fg_send_command(FilterGraph *fg, double time, const char *target, const char *command, const char *arg, int all_filters)
@ LATENCY_PROBE_FILTER_PRE
void opt_match_per_stream_int64(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int64_t *out)
AVRational frame_rate_filter
SpecifierOptList hwaccel_output_formats
SpecifierOptList metadata
const AVChannelLayout * ch_layouts
atomic_uint nb_output_dumped
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
void of_free(OutputFile **pof)
EncStatsComponent * components
int assert_file_overwrite(const char *filename)
SpecifierOptList intra_matrices
SpecifierOptList stream_groups
AVRational frame_aspect_ratio
@ KF_FORCE_SOURCE_NO_DROP
int dec_init(Decoder **pdec, Scheduler *sch, AVDictionary **dec_opts, const DecoderOpts *o, AVFrame *param_out)
SpecifierOptList hwaccel_devices
@ VIEW_SPECIFIER_TYPE_NONE
SpecifierOptList autoscale
SpecifierOptList sample_fmts
int ignore_unknown_streams
int encoder_thread(void *arg)
SpecifierOptList fix_sub_duration
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
double expr_const_values[FKF_NB]
void of_enc_stats_close(void)
Describe the class of an AVClass context structure.
int dec_create(const OptionsContext *o, const char *arg, Scheduler *sch)
Create a standalone decoder.
int dec_request_view(Decoder *dec, const ViewSpecifier *vs, SchedulerNode *src)
SpecifierOptList audio_channels
SpecifierOptList fix_sub_duration_heartbeat
int hw_device_init_from_type(enum AVHWDeviceType type, const char *device, HWDevice **dev_out)
Rational number (pair of numerator and denominator).
@ OFILTER_FLAG_AUDIO_24BIT
enum AVColorSpace * color_spaces
SpecifierOptList copy_prior_start
SpecifierOptList frame_aspect_ratios
SpecifierOptList reinit_filters
SpecifierOptList dump_attachment
int64_t wallclock[LATENCY_PROBE_NB]
const FrameData * packet_data_c(AVPacket *pkt)
int of_stream_init(OutputFile *of, OutputStream *ost, const AVCodecContext *enc_ctx)
void update_benchmark(const char *fmt,...)
SpecifierOptList display_vflips
const char * logfile_prefix
SpecifierOptList max_frames
FilterGraph ** filtergraphs
@ DECODER_FLAG_FIX_SUB_DURATION
enum VideoSyncMethod vsync_method
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
enum AVColorRange * color_ranges
SpecifierOptList enc_stats_post_fmt
@ FRAME_OPAQUE_SEND_COMMAND
An AVChannelLayout holds information about the channel layout of audio data.
SpecifierOptList enc_stats_pre
int filtergraph_is_simple(const FilterGraph *fg)
SpecifierOptList apply_cropping
AVRational max_frame_rate
int enc_alloc(Encoder **penc, const AVCodec *codec, Scheduler *sch, unsigned sch_idx, void *log_parent)
HWDevice * hw_device_get_by_type(enum AVHWDeviceType type)
enum AVColorSpace color_space
SpecifierOptList disposition
int fg_finalise_bindings(void)
double readrate_initial_burst
SpecifierOptList display_rotations
void opt_match_per_stream_dbl(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, double *out)
SpecifierOptList ts_scale
SpecifierOptList chroma_intra_matrices
SpecifierOptList frame_rates
SpecifierOptList codec_names
SpecifierOptList autorotate
SpecifierOptList fps_mode
float shortest_buf_duration
AVColorSpace
YUV colorspace type.
SpecifierOptList mux_stats
OutputFile ** output_files
SpecifierOptList muxing_queue_data_threshold
SpecifierOptList hwaccels
OutputStream * ost_iter(OutputStream *prev)
SpecifierOptList enc_stats_post
char * attachment_filename
SpecifierOptList metadata_map
void dec_free(Decoder **pdec)
void enc_free(Encoder **penc)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
@ VIEW_SPECIFIER_TYPE_IDX
FrameData * packet_data(AVPacket *pkt)
@ DECODER_FLAG_TOP_FIELD_FIRST
void hw_device_free_all(void)
void ifile_close(InputFile **f)
SpecifierOptList max_muxing_queue_size
HWDevice * filter_hw_device
main external API structure.
SpecifierOptList inter_matrices
SpecifierOptList audio_sample_rate
@ PKT_OPAQUE_SUB_HEARTBEAT
const FrameData * frame_data_c(AVFrame *frame)
SpecifierOptList frame_sizes
FrameData * frame_data(AVFrame *frame)
Get our axiliary frame data attached to the frame, allocating it if needed.
int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
enum VideoSyncMethod video_sync_method
SpecifierOptList codec_tags
SpecifierOptList filter_scripts
SpecifierOptList time_bases
enum ViewSpecifierType type
A reference to a data buffer.
InputStream * ist_iter(InputStream *prev)
@ DECODER_FLAG_TS_UNRELIABLE
atomic_uint_least64_t nb_frames_drop
int auto_conversion_filters
SpecifierOptList rc_overrides
int of_open(const OptionsContext *o, const char *filename, Scheduler *sch)
SpecifierOptList copy_initial_nonkeyframes
const char ** attachments
This structure stores compressed data.
@ OFILTER_FLAG_DISABLE_CONVERT
enum AVColorRange color_range
int muxer_thread(void *arg)
int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used, void *logctx, int decode)
float dts_error_threshold
AVBufferRef * hw_device_for_filter(void)
Get a hardware device to be used with this filtergraph.
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
void opt_match_per_stream_str(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, const char **out)
SpecifierOptList guess_layout_max
AVColorRange
Visual content value range.
int64_t recording_time
desired length of the resulting file in microseconds == AV_TIME_BASE units
HWDevice * hw_device_get_by_name(const char *name)
@ PKT_OPAQUE_FIX_SUB_DURATION
enum AVHWDeviceType hwaccel_device_type
int of_write_trailer(OutputFile *of)
InputStream * ist_find_unused(enum AVMediaType type)
Find an unused input stream of given type.
SpecifierOptList bitstream_filters
intptr_t atomic_uint_least64_t
SpecifierOptList enc_time_bases
SpecifierOptList top_field_first
atomic_uint_least64_t nb_frames_dup
int filter_complex_nbthreads
@ LATENCY_PROBE_FILTER_POST