FFmpeg
Macros | Functions | Variables
ffmpeg_opt.c File Reference
#include "config.h"
#include <stdint.h>
#include "ffmpeg.h"
#include "cmdutils.h"
#include "opt_common.h"
#include "sync_queue.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
#include "libavfilter/avfilter.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/display.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(OptionsContext, x)
 

Functions

static void uninit_options (OptionsContext *o)
 
static void init_options (OptionsContext *o)
 
static int show_hwaccels (void *optctx, const char *opt, const char *arg)
 
AVDictionarystrip_specifiers (const AVDictionary *dict)
 
int parse_and_set_vsync (const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
 
static void correct_input_start_times (void)
 
static int apply_sync_offsets (void)
 
static int opt_filter_threads (void *optctx, const char *opt, const char *arg)
 
static int opt_abort_on (void *optctx, const char *opt, const char *arg)
 
static int opt_stats_period (void *optctx, const char *opt, const char *arg)
 
static int opt_audio_codec (void *optctx, const char *opt, const char *arg)
 
static int opt_video_codec (void *optctx, const char *opt, const char *arg)
 
static int opt_subtitle_codec (void *optctx, const char *opt, const char *arg)
 
static int opt_data_codec (void *optctx, const char *opt, const char *arg)
 
static int opt_map (void *optctx, const char *opt, const char *arg)
 
static int opt_attach (void *optctx, const char *opt, const char *arg)
 
static int opt_map_channel (void *optctx, const char *opt, const char *arg)
 
static int opt_sdp_file (void *optctx, const char *opt, const char *arg)
 
static int opt_init_hw_device (void *optctx, const char *opt, const char *arg)
 
static int opt_filter_hw_device (void *optctx, const char *opt, const char *arg)
 
static int opt_recording_timestamp (void *optctx, const char *opt, const char *arg)
 
const AVCodecfind_codec_or_die (const char *name, enum AVMediaType type, int encoder)
 
void assert_file_overwrite (const char *filename)
 
char * file_read (const char *filename)
 
static int opt_streamid (void *optctx, const char *opt, const char *arg)
 
static int init_complex_filters (void)
 
static int opt_target (void *optctx, const char *opt, const char *arg)
 
static int opt_vstats_file (void *optctx, const char *opt, const char *arg)
 
static int opt_vstats (void *optctx, const char *opt, const char *arg)
 
static int opt_video_frames (void *optctx, const char *opt, const char *arg)
 
static int opt_audio_frames (void *optctx, const char *opt, const char *arg)
 
static int opt_data_frames (void *optctx, const char *opt, const char *arg)
 
static int opt_default_new (OptionsContext *o, const char *opt, const char *arg)
 
static int opt_preset (void *optctx, const char *opt, const char *arg)
 
static int opt_old2new (void *optctx, const char *opt, const char *arg)
 
static int opt_bitrate (void *optctx, const char *opt, const char *arg)
 
static int opt_qscale (void *optctx, const char *opt, const char *arg)
 
static int opt_profile (void *optctx, const char *opt, const char *arg)
 
static int opt_video_filters (void *optctx, const char *opt, const char *arg)
 
static int opt_audio_filters (void *optctx, const char *opt, const char *arg)
 
static int opt_vsync (void *optctx, const char *opt, const char *arg)
 
static int opt_timecode (void *optctx, const char *opt, const char *arg)
 
static int opt_audio_qscale (void *optctx, const char *opt, const char *arg)
 
static int opt_filter_complex (void *optctx, const char *opt, const char *arg)
 
static int opt_filter_complex_script (void *optctx, const char *opt, const char *arg)
 
void show_help_default (const char *opt, const char *arg)
 Per-fftool specific help handler. More...
 
void show_usage (void)
 

Variables

const char *const opt_name_codec_names [] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL}
 
const char *const opt_name_frame_rates [] = {"r", NULL}
 
const char *const opt_name_codec_tags [] = {"tag", "atag", "vtag", "stag", NULL}
 
const char *const opt_name_top_field_first [] = {"top", NULL}
 
HWDevicefilter_hw_device
 
char * vstats_filename
 
char * sdp_filename
 
float audio_drift_threshold = 0.1
 
float dts_delta_threshold = 10
 
float dts_error_threshold = 3600*30
 
enum VideoSyncMethod video_sync_method = VSYNC_AUTO
 
float frame_drop_threshold = 0
 
int do_benchmark = 0
 
int do_benchmark_all = 0
 
int do_hex_dump = 0
 
int do_pkt_dump = 0
 
int copy_ts = 0
 
int start_at_zero = 0
 
int copy_tb = -1
 
int debug_ts = 0
 
int exit_on_error = 0
 
int abort_on_flags = 0
 
int print_stats = -1
 
int qp_hist = 0
 
int stdin_interaction = 1
 
float max_error_rate = 2.0/3
 
char * filter_nbthreads
 
int filter_complex_nbthreads = 0
 
int vstats_version = 2
 
int auto_conversion_filters = 1
 
int64_t stats_period = 500000
 
static int file_overwrite = 0
 
static int no_file_overwrite = 0
 
int do_psnr = 0
 
int ignore_unknown_streams = 0
 
int copy_unknown_streams = 0
 
int recast_media = 0
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(OptionsContext, x)

Function Documentation

◆ uninit_options()

static void uninit_options ( OptionsContext o)
static

Definition at line 102 of file ffmpeg_opt.c.

◆ init_options()

static void init_options ( OptionsContext o)
static

Definition at line 136 of file ffmpeg_opt.c.

◆ show_hwaccels()

static int show_hwaccels ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 154 of file ffmpeg_opt.c.

◆ strip_specifiers()

AVDictionary* strip_specifiers ( const AVDictionary dict)

Definition at line 167 of file ffmpeg_opt.c.

Referenced by ifile_open(), and validate_enc_avopt().

◆ parse_and_set_vsync()

int parse_and_set_vsync ( const char *  arg,
int vsync_var,
int  file_idx,
int  st_idx,
int  is_global 
)

Definition at line 184 of file ffmpeg_opt.c.

Referenced by new_video_stream(), and opt_vsync().

◆ correct_input_start_times()

static void correct_input_start_times ( void  )
static

Definition at line 205 of file ffmpeg_opt.c.

◆ apply_sync_offsets()

static int apply_sync_offsets ( void  )
static

Definition at line 242 of file ffmpeg_opt.c.

◆ opt_filter_threads()

static int opt_filter_threads ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 294 of file ffmpeg_opt.c.

◆ opt_abort_on()

static int opt_abort_on ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 301 of file ffmpeg_opt.c.

◆ opt_stats_period()

static int opt_stats_period ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 320 of file ffmpeg_opt.c.

◆ opt_audio_codec()

static int opt_audio_codec ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 335 of file ffmpeg_opt.c.

Referenced by opt_preset(), and opt_target().

◆ opt_video_codec()

static int opt_video_codec ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 341 of file ffmpeg_opt.c.

Referenced by opt_preset(), and opt_target().

◆ opt_subtitle_codec()

static int opt_subtitle_codec ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 347 of file ffmpeg_opt.c.

Referenced by opt_preset().

◆ opt_data_codec()

static int opt_data_codec ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 353 of file ffmpeg_opt.c.

Referenced by opt_preset().

◆ opt_map()

static int opt_map ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 359 of file ffmpeg_opt.c.

◆ opt_attach()

static int opt_attach ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 450 of file ffmpeg_opt.c.

◆ opt_map_channel()

static int opt_map_channel ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 459 of file ffmpeg_opt.c.

◆ opt_sdp_file()

static int opt_sdp_file ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 543 of file ffmpeg_opt.c.

◆ opt_init_hw_device()

static int opt_init_hw_device ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 582 of file ffmpeg_opt.c.

◆ opt_filter_hw_device()

static int opt_filter_hw_device ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 597 of file ffmpeg_opt.c.

◆ opt_recording_timestamp()

static int opt_recording_timestamp ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 611 of file ffmpeg_opt.c.

◆ find_codec_or_die()

const AVCodec* find_codec_or_die ( const char *  name,
enum AVMediaType  type,
int  encoder 
)

Definition at line 626 of file ffmpeg_opt.c.

Referenced by choose_decoder(), choose_encoder(), and ifile_open().

◆ assert_file_overwrite()

void assert_file_overwrite ( const char *  filename)

Definition at line 655 of file ffmpeg_opt.c.

Referenced by dump_attachment(), and of_open().

◆ file_read()

char* file_read ( const char *  filename)

Definition at line 699 of file ffmpeg_opt.c.

Referenced by get_ost_filters(), new_video_stream(), and opt_filter_complex_script().

◆ opt_streamid()

static int opt_streamid ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 725 of file ffmpeg_opt.c.

◆ init_complex_filters()

static int init_complex_filters ( void  )
static

Definition at line 747 of file ffmpeg_opt.c.

◆ opt_target()

static int opt_target ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 759 of file ffmpeg_opt.c.

◆ opt_vstats_file()

static int opt_vstats_file ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 902 of file ffmpeg_opt.c.

Referenced by opt_vstats().

◆ opt_vstats()

static int opt_vstats ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 909 of file ffmpeg_opt.c.

◆ opt_video_frames()

static int opt_video_frames ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 925 of file ffmpeg_opt.c.

◆ opt_audio_frames()

static int opt_audio_frames ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 931 of file ffmpeg_opt.c.

◆ opt_data_frames()

static int opt_data_frames ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 937 of file ffmpeg_opt.c.

◆ opt_default_new()

static int opt_default_new ( OptionsContext o,
const char *  opt,
const char *  arg 
)
static

Definition at line 943 of file ffmpeg_opt.c.

Referenced by opt_preset().

◆ opt_preset()

static int opt_preset ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 963 of file ffmpeg_opt.c.

◆ opt_old2new()

static int opt_old2new ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1011 of file ffmpeg_opt.c.

◆ opt_bitrate()

static int opt_bitrate ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1023 of file ffmpeg_opt.c.

◆ opt_qscale()

static int opt_qscale ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1039 of file ffmpeg_opt.c.

◆ opt_profile()

static int opt_profile ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1056 of file ffmpeg_opt.c.

◆ opt_video_filters()

static int opt_video_filters ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1068 of file ffmpeg_opt.c.

◆ opt_audio_filters()

static int opt_audio_filters ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1074 of file ffmpeg_opt.c.

◆ opt_vsync()

static int opt_vsync ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1080 of file ffmpeg_opt.c.

◆ opt_timecode()

static int opt_timecode ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1087 of file ffmpeg_opt.c.

◆ opt_audio_qscale()

static int opt_audio_qscale ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1101 of file ffmpeg_opt.c.

◆ opt_filter_complex()

static int opt_filter_complex ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1107 of file ffmpeg_opt.c.

◆ opt_filter_complex_script()

static int opt_filter_complex_script ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1119 of file ffmpeg_opt.c.

◆ show_help_default()

void show_help_default ( const char *  opt,
const char *  arg 
)

Per-fftool specific help handler.

Implemented in each fftool, called by show_help().

Definition at line 1133 of file ffmpeg_opt.c.

◆ show_usage()

void show_usage ( void  )

Definition at line 1205 of file ffmpeg_opt.c.

Referenced by main(), and show_help_default().

Variable Documentation

◆ opt_name_codec_names

const char* const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL}

Definition at line 56 of file ffmpeg_opt.c.

◆ opt_name_frame_rates

const char* const opt_name_frame_rates[] = {"r", NULL}

Definition at line 57 of file ffmpeg_opt.c.

◆ opt_name_codec_tags

const char* const opt_name_codec_tags[] = {"tag", "atag", "vtag", "stag", NULL}

Definition at line 58 of file ffmpeg_opt.c.

◆ opt_name_top_field_first

const char* const opt_name_top_field_first[] = {"top", NULL}

Definition at line 59 of file ffmpeg_opt.c.

◆ filter_hw_device

HWDevice* filter_hw_device

Definition at line 61 of file ffmpeg_opt.c.

Referenced by hw_device_setup_for_filter(), and opt_filter_hw_device().

◆ vstats_filename

char* vstats_filename

Definition at line 63 of file ffmpeg_opt.c.

Referenced by encode_frame(), ffmpeg_cleanup(), opt_vstats_file(), and update_video_stats().

◆ sdp_filename

char* sdp_filename

Definition at line 64 of file ffmpeg_opt.c.

Referenced by mux_check_init(), opt_sdp_file(), and print_sdp().

◆ audio_drift_threshold

float audio_drift_threshold = 0.1

Definition at line 66 of file ffmpeg_opt.c.

◆ dts_delta_threshold

float dts_delta_threshold = 10

Definition at line 67 of file ffmpeg_opt.c.

Referenced by ts_discontinuity_detect().

◆ dts_error_threshold

float dts_error_threshold = 3600*30

Definition at line 68 of file ffmpeg_opt.c.

Referenced by do_video_out(), and ts_discontinuity_detect().

◆ video_sync_method

enum VideoSyncMethod video_sync_method = VSYNC_AUTO

Definition at line 70 of file ffmpeg_opt.c.

Referenced by new_video_stream(), opt_vsync(), and parse_and_set_vsync().

◆ frame_drop_threshold

float frame_drop_threshold = 0

Definition at line 71 of file ffmpeg_opt.c.

Referenced by do_video_out().

◆ do_benchmark

int do_benchmark = 0

Definition at line 72 of file ffmpeg_opt.c.

Referenced by ffmpeg_cleanup(), and main().

◆ do_benchmark_all

int do_benchmark_all = 0

Definition at line 73 of file ffmpeg_opt.c.

Referenced by update_benchmark().

◆ do_hex_dump

int do_hex_dump = 0

Definition at line 74 of file ffmpeg_opt.c.

Referenced by input_thread().

◆ do_pkt_dump

int do_pkt_dump = 0

Definition at line 75 of file ffmpeg_opt.c.

Referenced by input_thread().

◆ copy_ts

int copy_ts = 0

◆ start_at_zero

int start_at_zero = 0

◆ copy_tb

int copy_tb = -1

◆ debug_ts

int debug_ts = 0

◆ exit_on_error

int exit_on_error = 0

◆ abort_on_flags

int abort_on_flags = 0

Definition at line 81 of file ffmpeg_opt.c.

Referenced by opt_abort_on(), and transcode().

◆ print_stats

int print_stats = -1

Definition at line 82 of file ffmpeg_opt.c.

Referenced by print_report().

◆ qp_hist

int qp_hist = 0

Definition at line 83 of file ffmpeg_opt.c.

Referenced by check_keyboard_interaction(), and print_report().

◆ stdin_interaction

int stdin_interaction = 1

Definition at line 84 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite(), ifile_open(), term_init(), and transcode().

◆ max_error_rate

float max_error_rate = 2.0/3

Definition at line 85 of file ffmpeg_opt.c.

Referenced by main().

◆ filter_nbthreads

char* filter_nbthreads

Definition at line 86 of file ffmpeg_opt.c.

Referenced by configure_filtergraph(), ffmpeg_cleanup(), and opt_filter_threads().

◆ filter_complex_nbthreads

int filter_complex_nbthreads = 0

Definition at line 87 of file ffmpeg_opt.c.

Referenced by configure_filtergraph().

◆ vstats_version

int vstats_version = 2

Definition at line 88 of file ffmpeg_opt.c.

Referenced by update_video_stats().

◆ auto_conversion_filters

int auto_conversion_filters = 1

Definition at line 89 of file ffmpeg_opt.c.

Referenced by configure_filtergraph().

◆ stats_period

int64_t stats_period = 500000

Definition at line 90 of file ffmpeg_opt.c.

Referenced by opt_stats_period(), and print_report().

◆ file_overwrite

int file_overwrite = 0
static

Definition at line 93 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite().

◆ no_file_overwrite

int no_file_overwrite = 0
static

Definition at line 94 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite().

◆ do_psnr

int do_psnr = 0

Definition at line 96 of file ffmpeg_opt.c.

Referenced by new_video_stream().

◆ ignore_unknown_streams

int ignore_unknown_streams = 0

Definition at line 98 of file ffmpeg_opt.c.

Referenced by map_manual().

◆ copy_unknown_streams

int copy_unknown_streams = 0

Definition at line 99 of file ffmpeg_opt.c.

Referenced by map_manual().

◆ recast_media

int recast_media = 0

Definition at line 100 of file ffmpeg_opt.c.

Referenced by choose_decoder(), and find_codec_or_die().