aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-11 23:35:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-12 00:32:54 +0200
commit411cc5c46a89ce0a79832c37d0eab1ed884e5423 (patch)
tree0217179f24cd9629b568b521b1c749e51d6ea7c9 /ffmpeg.c
parent5a6f4a130226e04e0db3bd7c7c1ff76fe3f06080 (diff)
parent6cfed1127005e9d79e03b4b04fd75124a291d3db (diff)
downloadffmpeg-411cc5c46a89ce0a79832c37d0eab1ed884e5423.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits) audioconvert: add explanatory comments to channel_names array audioconvert: K&R whitespace cosmetics avconv: use correct index when selecting metadata to write to. avconv: fix inverted variable doc/avconv: document option types (input/output/per-stream/...) doc/avtools-common-opts: write a section about stream specifiers. doc/avconv: remove two pointless paragraphs. doc/avconv: document that global options should be specified first. doc/avconv: remove entries for nonexistent options doc/avconv: remove documentation for removed 'timestamp' option doc: cosmetics, rename fftools-common-opts to avtools-.... avconv: move streamid_map to options context. avconv: extend -vf syntax avconv: move top_field_first to options context. avconv: move inter/intra matrix to options context. avconv: remove -psnr option. avconv: remove me_threshold option. avconv: move video_rc_override_string to options context. avconv: move frame pixel format to the options context. avconv: move frame aspect ratio to the options context. ... Conflicts: avconv.c cmdutils_common_opts.h doc/avconv.texi Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c566
1 files changed, 229 insertions, 337 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 048d2fabe1..fa7a3943b5 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -111,39 +111,16 @@ static const OptionDef options[];
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
-/* indexed by output file stream index */
-static int *streamid_map = NULL;
-static int nb_streamid_map = 0;
-
-static int frame_width = 0;
-static int frame_height = 0;
-static float frame_aspect_ratio = 0;
-static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
static int frame_bits_per_raw_sample = 0;
-static enum AVSampleFormat audio_sample_fmt = AV_SAMPLE_FMT_NONE;
-static AVRational frame_rate;
-static float video_qscale = 0;
-static uint16_t *intra_matrix = NULL;
-static uint16_t *inter_matrix = NULL;
-static const char *video_rc_override_string=NULL;
static int video_discard = 0;
static char *video_codec_name = NULL;
static int same_quant = 0;
static int do_deinterlace = 0;
-static int top_field_first = -1;
-static int me_threshold = 0;
static int intra_dc_precision = 8;
static int loop_input = 0;
static int loop_output = AVFMT_NOOUTPUTLOOP;
static int qp_hist = 0;
-#if CONFIG_AVFILTER
-static char *vfilters = NULL;
-#endif
-
static int intra_only = 0;
-static int audio_sample_rate = 0;
-#define QSCALE_NONE -99999
-static float audio_qscale = QSCALE_NONE;
static char *audio_codec_name = NULL;
static char *subtitle_codec_name = NULL;
@@ -153,7 +130,6 @@ static int file_overwrite = 0;
static int do_benchmark = 0;
static int do_hex_dump = 0;
static int do_pkt_dump = 0;
-static int do_psnr = 0;
static int do_pass = 0;
static const char *pass_logfilename_prefix;
static int video_sync_method= -1;
@@ -164,7 +140,6 @@ static int copy_tb= 0;
static int opt_shortest = 0;
static char *vstats_filename;
static FILE *vstats_file;
-static int opt_programid = 0;
static int copy_initial_nonkeyframes = 0;
static int audio_volume = 256;
@@ -173,7 +148,6 @@ static int exit_on_error = 0;
static int using_stdin = 0;
static int verbose = 1;
static int run_as_daemon = 0;
-static int thread_count= 1;
static int q_pressed = 0;
static int64_t video_size = 0;
static int64_t audio_size = 0;
@@ -181,8 +155,6 @@ static int64_t extra_size = 0;
static int nb_frames_dup = 0;
static int nb_frames_drop = 0;
static int input_sync;
-static int force_fps = 0;
-static char *forced_key_frames = NULL;
static float dts_delta_threshold = 10;
@@ -247,6 +219,8 @@ typedef struct OutputStream {
int resample_width;
int resample_pix_fmt;
AVRational frame_rate;
+ int force_fps;
+ int top_field_first;
float frame_aspect_ratio;
@@ -314,6 +288,14 @@ typedef struct OptionsContext {
int nb_codec_names;
SpecifierOpt *audio_channels;
int nb_audio_channels;
+ SpecifierOpt *audio_sample_rate;
+ int nb_audio_sample_rate;
+ SpecifierOpt *frame_rates;
+ int nb_frame_rates;
+ SpecifierOpt *frame_sizes;
+ int nb_frame_sizes;
+ SpecifierOpt *frame_pix_fmts;
+ int nb_frame_pix_fmts;
/* input options */
int64_t input_ts_offset;
@@ -344,6 +326,10 @@ typedef struct OptionsContext {
int subtitle_disable;
int data_disable;
+ /* indexed by output file stream index */
+ int *streamid_map;
+ int nb_streamid_map;
+
SpecifierOpt *metadata;
int nb_metadata;
SpecifierOpt *max_frames;
@@ -352,6 +338,28 @@ typedef struct OptionsContext {
int nb_bitstream_filters;
SpecifierOpt *codec_tags;
int nb_codec_tags;
+ SpecifierOpt *sample_fmts;
+ int nb_sample_fmts;
+ SpecifierOpt *qscale;
+ int nb_qscale;
+ SpecifierOpt *forced_key_frames;
+ int nb_forced_key_frames;
+ SpecifierOpt *force_fps;
+ int nb_force_fps;
+ SpecifierOpt *frame_aspect_ratios;
+ int nb_frame_aspect_ratios;
+ SpecifierOpt *rc_overrides;
+ int nb_rc_overrides;
+ SpecifierOpt *intra_matrices;
+ int nb_intra_matrices;
+ SpecifierOpt *inter_matrices;
+ int nb_inter_matrices;
+ SpecifierOpt *top_field_first;
+ int nb_top_field_first;
+#if CONFIG_AVFILTER
+ SpecifierOpt *filters;
+ int nb_filters;
+#endif
} OptionsContext;
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
@@ -392,6 +400,7 @@ static void reset_options(OptionsContext *o, int is_input)
av_freep(&o->stream_maps);
av_freep(&o->meta_data_maps);
+ av_freep(&o->streamid_map);
memset(o, 0, sizeof(*o));
@@ -631,9 +640,6 @@ void exit_program(int ret)
for (i = 0; i < nb_input_streams; i++)
av_dict_free(&input_streams[i].opts);
- av_free(intra_matrix);
- av_free(inter_matrix);
-
if (vstats_file)
fclose(vstats_file);
av_free(vstats_filename);
@@ -1288,16 +1294,16 @@ static void do_video_out(AVFormatContext *s,
settings */
big_picture.interlaced_frame = in_picture->interlaced_frame;
if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {
- if(top_field_first == -1)
+ if (ost->top_field_first == -1)
big_picture.top_field_first = in_picture->top_field_first;
else
- big_picture.top_field_first = top_field_first;
+ big_picture.top_field_first = !!ost->top_field_first;
}
/* handles same_quant here. This is not correct because it may
not be a global option */
big_picture.quality = quality;
- if(!me_threshold)
+ if (!enc->me_threshold)
big_picture.pict_type = 0;
// big_picture.pts = AV_NOPTS_VALUE;
big_picture.pts= ost->sync_opts;
@@ -1991,7 +1997,7 @@ static int transcode_init(OutputFile *output_files,
InputFile *input_files,
int nb_input_files)
{
- int ret = 0, i, j;
+ int ret = 0, i, j, k;
AVFormatContext *os;
AVCodecContext *codec, *icodec;
OutputStream *ost;
@@ -2175,7 +2181,7 @@ static int transcode_init(OutputFile *output_files,
if (!ost->frame_rate.num)
ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1};
- if (ost->enc && ost->enc->supported_framerates && !force_fps) {
+ if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) {
int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates);
ost->frame_rate = ost->enc->supported_framerates[idx];
}
@@ -2276,6 +2282,9 @@ static int transcode_init(OutputFile *output_files,
av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
"It takes bits/s as argument, not kbits/s\n");
extra_size += ost->st->codec->extradata_size;
+
+ if (ost->st->codec->me_threshold)
+ input_streams[ost->source_index].st->codec->debug |= FF_DEBUG_MV;
}
}
@@ -2284,6 +2293,22 @@ static int transcode_init(OutputFile *output_files,
if ((ret = init_input_stream(i, output_streams, nb_output_streams, error, sizeof(error))) < 0)
goto dump_format;
+ /* discard unused programs */
+ for (i = 0; i < nb_input_files; i++) {
+ InputFile *ifile = &input_files[i];
+ for (j = 0; j < ifile->ctx->nb_programs; j++) {
+ AVProgram *p = ifile->ctx->programs[j];
+ int discard = AVDISCARD_ALL;
+
+ for (k = 0; k < p->nb_stream_indexes; k++)
+ if (!input_streams[ifile->ist_index + p->stream_index[k]].discard) {
+ discard = AVDISCARD_DEFAULT;
+ break;
+ }
+ p->discard = discard;
+ }
+ }
+
/* open files and write file headers */
for (i = 0; i < nb_output_files; i++) {
os = output_files[i].ctx;
@@ -2662,69 +2687,24 @@ static int transcode(OutputFile *output_files,
return ret;
}
-static int opt_video_rc_override_string(const char *opt, const char *arg)
-{
- video_rc_override_string = arg;
- return 0;
-}
-
-static int opt_me_threshold(const char *opt, const char *arg)
-{
- me_threshold = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
- return 0;
-}
-
static int opt_verbose(const char *opt, const char *arg)
{
verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);
return 0;
}
-static int opt_frame_rate(const char *opt, const char *arg)
-{
- if (av_parse_video_rate(&frame_rate, arg) < 0) {
- fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);
- exit_program(1);
- }
- return 0;
-}
-
static int opt_frame_crop(const char *opt, const char *arg)
{
fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt);
return AVERROR(EINVAL);
}
-static int opt_frame_size(const char *opt, const char *arg)
-{
- if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
- fprintf(stderr, "Incorrect frame size\n");
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
static int opt_pad(const char *opt, const char *arg) {
fprintf(stderr, "Option '%s' has been removed, use the pad filter instead\n", opt);
return -1;
}
-static int opt_frame_pix_fmt(const char *opt, const char *arg)
-{
- if (strcmp(arg, "list")) {
- frame_pix_fmt = av_get_pix_fmt(arg);
- if (frame_pix_fmt == PIX_FMT_NONE) {
- fprintf(stderr, "Unknown pixel format requested: %s\n", arg);
- return AVERROR(EINVAL);
- }
- } else {
- opt_pix_fmts(NULL, NULL);
- exit_program(0);
- }
- return 0;
-}
-
-static int opt_frame_aspect_ratio(const char *opt, const char *arg)
+static double parse_frame_aspect_ratio(const char *arg)
{
int x = 0, y = 0;
double ar = 0;
@@ -2743,60 +2723,9 @@ static int opt_frame_aspect_ratio(const char *opt, const char *arg)
if (!ar) {
fprintf(stderr, "Incorrect aspect ratio specification.\n");
- return AVERROR(EINVAL);
- }
- frame_aspect_ratio = ar;
- return 0;
-}
-
-static int opt_qscale(const char *opt, const char *arg)
-{
- video_qscale = parse_number_or_die(opt, arg, OPT_FLOAT, 0, 255);
- if (video_qscale <= 0 || video_qscale > 255) {
- fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
-static int opt_top_field_first(const char *opt, const char *arg)
-{
- top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1);
- return opt_default(opt, arg);
-}
-
-static int opt_thread_count(const char *opt, const char *arg)
-{
- thread_count= parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-#if !HAVE_THREADS
- if (verbose >= 0)
- fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n");
-#endif
- return 0;
-}
-
-static int opt_audio_sample_fmt(const char *opt, const char *arg)
-{
- if (strcmp(arg, "list")) {
- audio_sample_fmt = av_get_sample_fmt(arg);
- if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) {
- av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
- return AVERROR(EINVAL);
- }
- } else {
- int i;
- char fmt_str[128];
- for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
- printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
- exit_program(0);
+ exit_program(1);
}
- return 0;
-}
-
-static int opt_audio_rate(const char *opt, const char *arg)
-{
- audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
- return 0;
+ return ar;
}
static int opt_video_channel(const char *opt, const char *arg)
@@ -3042,8 +2971,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
InputStream *ist;
double scale = 1.0;
- dec->thread_count = thread_count;
-
input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1);
ist = &input_streams[nb_input_streams - 1];
ist->st = st;
@@ -3073,8 +3000,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
if (dec->lowres) {
dec->flags |= CODEC_FLAG_EMU_EDGE;
}
- if(me_threshold)
- dec->debug |= FF_DEBUG_MV;
if (dec->time_base.den != rfps*dec->ticks_per_frame || dec->time_base.num != rfps_base) {
@@ -3136,24 +3061,22 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena
print_error(filename, AVERROR(ENOMEM));
exit_program(1);
}
- if (audio_sample_rate) {
- snprintf(buf, sizeof(buf), "%d", audio_sample_rate);
+ if (o->nb_audio_sample_rate) {
+ snprintf(buf, sizeof(buf), "%d", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i);
av_dict_set(&format_opts, "sample_rate", buf, 0);
}
if (o->nb_audio_channels) {
snprintf(buf, sizeof(buf), "%d", o->audio_channels[o->nb_audio_channels - 1].u.i);
av_dict_set(&format_opts, "channels", buf, 0);
}
- if (frame_rate.num) {
- snprintf(buf, sizeof(buf), "%d/%d", frame_rate.num, frame_rate.den);
- av_dict_set(&format_opts, "framerate", buf, 0);
+ if (o->nb_frame_rates) {
+ av_dict_set(&format_opts, "framerate", o->frame_rates[o->nb_frame_rates - 1].u.str, 0);
}
- if (frame_width && frame_height) {
- snprintf(buf, sizeof(buf), "%dx%d", frame_width, frame_height);
- av_dict_set(&format_opts, "video_size", buf, 0);
+ if (o->nb_frame_sizes) {
+ av_dict_set(&format_opts, "video_size", o->frame_sizes[o->nb_frame_sizes - 1].u.str, 0);
}
- if (frame_pix_fmt != PIX_FMT_NONE)
- av_dict_set(&format_opts, "pixel_format", av_get_pix_fmt_name(frame_pix_fmt), 0);
+ if (o->nb_frame_pix_fmts)
+ av_dict_set(&format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);
ic->flags |= AVFMT_FLAG_NONBLOCK;
@@ -3170,30 +3093,6 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena
}
assert_avoptions(format_opts);
- if(opt_programid) {
- int i, j;
- int found=0;
- for(i=0; i<ic->nb_streams; i++){
- ic->streams[i]->discard= AVDISCARD_ALL;
- }
- for(i=0; i<ic->nb_programs; i++){
- AVProgram *p= ic->programs[i];
- if(p->id != opt_programid){
- p->discard = AVDISCARD_ALL;
- }else{
- found=1;
- for(j=0; j<p->nb_stream_indexes; j++){
- ic->streams[p->stream_index[j]]->discard= AVDISCARD_DEFAULT;
- }
- }
- }
- if(!found){
- fprintf(stderr, "Specified program id not found\n");
- exit_program(1);
- }
- opt_programid=0;
- }
-
/* apply forced codec ids */
for (i = 0; i < ic->nb_streams; i++)
choose_codec(o, ic, ic->streams[i], ic->streams[i]->codec->codec_type);
@@ -3239,14 +3138,6 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena
input_files[nb_input_files - 1].nb_streams = ic->nb_streams;
input_files[nb_input_files - 1].rate_emu = o->rate_emu;
- top_field_first = -1;
- frame_rate = (AVRational){0, 0};
- frame_pix_fmt = PIX_FMT_NONE;
- frame_height = 0;
- frame_width = 0;
- audio_sample_rate = 0;
- audio_sample_fmt = AV_SAMPLE_FMT_NONE;
-
for (i = 0; i < orig_nb_streams; i++)
av_dict_free(&opts[i]);
av_freep(&opts);
@@ -3281,11 +3172,12 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost,
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
- AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
+ AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
int idx = oc->nb_streams - 1;
int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL;
AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
+ double qscale = -1;
if (!st) {
av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n");
@@ -3335,10 +3227,33 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
st->codec->codec_tag = tag;
}
+ MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st);
+ if (qscale >= 0 || same_quant) {
+ st->codec->flags |= CODEC_FLAG_QSCALE;
+ st->codec->global_quality = FF_QP2LAMBDA * qscale;
+ }
+
ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
return ost;
}
+static void parse_matrix_coeffs(uint16_t *dest, const char *str)
+{
+ int i;
+ const char *p = str;
+ for(i = 0;; i++) {
+ dest[i] = atoi(p);
+ if(i == 63)
+ break;
+ p = strchr(p, ',');
+ if(!p) {
+ fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
+ exit_program(1);
+ }
+ p++;
+ }
+}
+
static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
{
AVStream *st;
@@ -3347,52 +3262,63 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO);
st = ost->st;
- if (!st->stream_copy) {
- ost->frame_aspect_ratio = frame_aspect_ratio;
- frame_aspect_ratio = 0;
-#if CONFIG_AVFILTER
- ost->avfilter = vfilters;
- vfilters = NULL;
-#endif
- }
-
- st->codec->thread_count= thread_count;
-
video_enc = st->codec;
if(oc->oformat->flags & AVFMT_GLOBALHEADER) {
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
- if (st->stream_copy) {
- video_enc->sample_aspect_ratio =
- st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
- } else {
- const char *p;
- int i;
+ if (!st->stream_copy) {
+ const char *p = NULL;
+ char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL;
+ char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
+ char *intra_matrix = NULL, *inter_matrix = NULL, *filters = NULL;
+ int i, force_fps = 0, top_field_first = -1;
+
+ MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
+ if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Invalid framerate value: %s\n", frame_rate);
+ exit_program(1);
+ }
- if (frame_rate.num)
- ost->frame_rate = frame_rate;
+ MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
+ if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Invalid frame size: %s.\n", frame_size);
+ exit_program(1);
+ }
+
+ MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
+ if (frame_aspect_ratio)
+ ost->frame_aspect_ratio = parse_frame_aspect_ratio(frame_aspect_ratio);
- video_enc->width = frame_width;
- video_enc->height = frame_height;
- video_enc->pix_fmt = frame_pix_fmt;
video_enc->bits_per_raw_sample = frame_bits_per_raw_sample;
+ MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
+ if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == PIX_FMT_NONE) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
+ exit_program(1);
+ }
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
if (intra_only)
video_enc->gop_size = 0;
- if (video_qscale || same_quant) {
- video_enc->flags |= CODEC_FLAG_QSCALE;
- video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
+ MATCH_PER_STREAM_OPT(intra_matrices, str, intra_matrix, oc, st);
+ if (intra_matrix) {
+ if (!(video_enc->intra_matrix = av_mallocz(sizeof(*video_enc->intra_matrix) * 64))) {
+ av_log(NULL, AV_LOG_ERROR, "Could not allocate memory for intra matrix.\n");
+ exit_program(1);
+ }
+ parse_matrix_coeffs(video_enc->intra_matrix, intra_matrix);
+ }
+ MATCH_PER_STREAM_OPT(inter_matrices, str, inter_matrix, oc, st);
+ if (inter_matrix) {
+ if (!(video_enc->inter_matrix = av_mallocz(sizeof(*video_enc->inter_matrix) * 64))) {
+ av_log(NULL, AV_LOG_ERROR, "Could not allocate memory for inter matrix.\n");
+ exit_program(1);
+ }
+ parse_matrix_coeffs(video_enc->inter_matrix, inter_matrix);
}
- if(intra_matrix)
- video_enc->intra_matrix = intra_matrix;
- if(inter_matrix)
- video_enc->inter_matrix = inter_matrix;
-
- p= video_rc_override_string;
+ MATCH_PER_STREAM_OPT(rc_overrides, str, p, oc, st);
for(i=0; p; i++){
int start, end, q;
int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
@@ -3419,12 +3345,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
- video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
- if (do_psnr)
- video_enc->flags|= CODEC_FLAG_PSNR;
-
/* two pass mode */
if (do_pass) {
if (do_pass == 1) {
@@ -3434,13 +3356,23 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
}
}
+ MATCH_PER_STREAM_OPT(forced_key_frames, str, forced_key_frames, oc, st);
if (forced_key_frames)
parse_forced_key_frames(forced_key_frames, ost, video_enc);
+
+ MATCH_PER_STREAM_OPT(force_fps, i, force_fps, oc, st);
+ ost->force_fps = force_fps;
+
+ MATCH_PER_STREAM_OPT(top_field_first, i, top_field_first, oc, st);
+ ost->top_field_first = top_field_first;
+
+#if CONFIG_AVFILTER
+ MATCH_PER_STREAM_OPT(filters, str, filters, oc, st);
+ if (filters)
+ ost->avfilter = av_strdup(filters);
+#endif
}
- /* reset some key parameters */
- av_freep(&forced_key_frames);
- frame_pix_fmt = PIX_FMT_NONE;
return ost;
}
@@ -3453,8 +3385,6 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO);
st = ost->st;
- st->codec->thread_count= thread_count;
-
audio_enc = st->codec;
audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -3462,16 +3392,18 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (!st->stream_copy) {
- if (audio_qscale > QSCALE_NONE) {
- audio_enc->flags |= CODEC_FLAG_QSCALE;
- audio_enc->global_quality = FF_QP2LAMBDA * audio_qscale;
- }
+ char *sample_fmt = NULL;
+
MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
- if (audio_sample_fmt != AV_SAMPLE_FMT_NONE)
- audio_enc->sample_fmt = audio_sample_fmt;
- if (audio_sample_rate)
- audio_enc->sample_rate = audio_sample_rate;
+ MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
+ if (sample_fmt &&
+ (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) {
+ av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", sample_fmt);
+ exit_program(1);
+ }
+
+ MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);
}
return ost;
@@ -3518,7 +3450,7 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
}
/* arg format is "output-stream-index:streamid-value". */
-static int opt_streamid(const char *opt, const char *arg)
+static int opt_streamid(OptionsContext *o, const char *opt, const char *arg)
{
int idx;
char *p;
@@ -3534,8 +3466,8 @@ static int opt_streamid(const char *opt, const char *arg)
}
*p++ = '\0';
idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
- streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
- streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
+ o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
+ o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
return 0;
}
@@ -3785,7 +3717,7 @@ static void opt_output_file(void *optctx, const char *filename)
}
if (o->chapters_input_file >= 0)
copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1],
- o->metadata_chapters_manual);
+ !o->metadata_chapters_manual);
/* copy metadata */
for (i = 0; i < o->nb_meta_data_maps; i++) {
@@ -3870,14 +3802,14 @@ static void opt_output_file(void *optctx, const char *filename)
av_log(NULL, AV_LOG_ERROR, "Invalid stream index %d in metadata specifier.\n", index);
exit_program(1);
}
- m = &oc->streams[i]->metadata;
+ m = &oc->streams[index]->metadata;
break;
case 'c':
if (index < 0 || index >= oc->nb_chapters) {
av_log(NULL, AV_LOG_ERROR, "Invalid chapter index %d in metadata specifier.\n", index);
exit_program(1);
}
- m = &oc->chapters[i]->metadata;
+ m = &oc->chapters[index]->metadata;
break;
default:
av_log(NULL, AV_LOG_ERROR, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
@@ -3887,16 +3819,6 @@ static void opt_output_file(void *optctx, const char *filename)
av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
}
- frame_rate = (AVRational){0, 0};
- frame_width = 0;
- frame_height = 0;
- audio_sample_rate = 0;
- audio_sample_fmt = AV_SAMPLE_FMT_NONE;
-
- av_freep(&streamid_map);
- nb_streamid_map = 0;
-
- av_freep(&forced_key_frames);
reset_options(o, 0);
}
@@ -3943,35 +3865,9 @@ static int64_t getmaxrss(void)
#endif
}
-static void parse_matrix_coeffs(uint16_t *dest, const char *str)
-{
- int i;
- const char *p = str;
- for(i = 0;; i++) {
- dest[i] = atoi(p);
- if(i == 63)
- break;
- p = strchr(p, ',');
- if(!p) {
- fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
- exit_program(1);
- }
- p++;
- }
-}
-
-static int opt_inter_matrix(const char *opt, const char *arg)
+static int opt_audio_qscale(OptionsContext *o, const char *opt, const char *arg)
{
- inter_matrix = av_mallocz(sizeof(uint16_t) * 64);
- parse_matrix_coeffs(inter_matrix, arg);
- return 0;
-}
-
-static int opt_intra_matrix(const char *opt, const char *arg)
-{
- intra_matrix = av_mallocz(sizeof(uint16_t) * 64);
- parse_matrix_coeffs(intra_matrix, arg);
- return 0;
+ return parse_option(o, "q:a", arg, options);
}
static void show_usage(void)
@@ -4067,34 +3963,25 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
norm = FILM;
arg += 5;
} else {
- int fr;
- /* Calculate FR via float to avoid int overflow */
- fr = (int)(frame_rate.num * 1000.0 / frame_rate.den);
- if(fr == 25000) {
- norm = PAL;
- } else if((fr == 29970) || (fr == 23976)) {
- norm = NTSC;
- } else {
- /* Try to determine PAL/NTSC by peeking in the input files */
- if(nb_input_files) {
- int i, j;
- for (j = 0; j < nb_input_files; j++) {
- for (i = 0; i < input_files[j].nb_streams; i++) {
- AVCodecContext *c = input_files[j].ctx->streams[i]->codec;
- if(c->codec_type != AVMEDIA_TYPE_VIDEO)
- continue;
- fr = c->time_base.den * 1000 / c->time_base.num;
- if(fr == 25000) {
- norm = PAL;
- break;
- } else if((fr == 29970) || (fr == 23976)) {
- norm = NTSC;
- break;
- }
- }
- if(norm != UNKNOWN)
+ /* Try to determine PAL/NTSC by peeking in the input files */
+ if(nb_input_files) {
+ int i, j, fr;
+ for (j = 0; j < nb_input_files; j++) {
+ for (i = 0; i < input_files[j].nb_streams; i++) {
+ AVCodecContext *c = input_files[j].ctx->streams[i]->codec;
+ if(c->codec_type != AVMEDIA_TYPE_VIDEO)
+ continue;
+ fr = c->time_base.den * 1000 / c->time_base.num;
+ if(fr == 25000) {
+ norm = PAL;
break;
+ } else if((fr == 29970) || (fr == 23976)) {
+ norm = NTSC;
+ break;
+ }
}
+ if(norm != UNKNOWN)
+ break;
}
}
if(verbose > 0 && norm != UNKNOWN)
@@ -4113,8 +4000,8 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_audio_codec(o, "c:a", "mp2");
parse_option(o, "f", "vcd", options);
- opt_frame_size("s", norm == PAL ? "352x288" : "352x240");
- opt_frame_rate("r", frame_rates[norm]);
+ parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
+ parse_option(o, "r", frame_rates[norm], options);
opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "1150000");
@@ -4123,7 +4010,7 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_default("bufsize", "327680"); // 40*1024*8;
opt_default("b:a", "224000");
- audio_sample_rate = 44100;
+ parse_option(o, "ar", "44100", options);
parse_option(o, "ac", "2", options);
opt_default("packetsize", "2324");
@@ -4141,9 +4028,9 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_audio_codec(o, "c:a", "mp2");
parse_option(o, "f", "svcd", options);
- opt_frame_size("s", norm == PAL ? "480x576" : "480x480");
- opt_frame_rate("r", frame_rates[norm]);
- opt_frame_pix_fmt("pix_fmt", "yuv420p");
+ parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
+ parse_option(o, "r", frame_rates[norm], options);
+ parse_option(o, "pix_fmt", "yuv420p", options);
opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "2040000");
@@ -4154,7 +4041,7 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_default("b:a", "224000");
- audio_sample_rate = 44100;
+ parse_option(o, "ar", "44100", options);
opt_default("packetsize", "2324");
@@ -4164,9 +4051,9 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_audio_codec(o, "c:a", "ac3");
parse_option(o, "f", "dvd", options);
- opt_frame_size("vcodec", norm == PAL ? "720x576" : "720x480");
- opt_frame_rate("r", frame_rates[norm]);
- opt_frame_pix_fmt("pix_fmt", "yuv420p");
+ parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
+ parse_option(o, "r", frame_rates[norm], options);
+ parse_option(o, "pix_fmt", "yuv420p", options);
opt_default("g", norm == PAL ? "15" : "18");
opt_default("b", "6000000");
@@ -4178,18 +4065,18 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
opt_default("b:a", "448000");
- audio_sample_rate = 48000;
+ parse_option(o, "ar", "48000", options);
} else if(!strncmp(arg, "dv", 2)) {
parse_option(o, "f", "dv", options);
- opt_frame_size("s", norm == PAL ? "720x576" : "720x480");
- opt_frame_pix_fmt("pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
- norm == PAL ? "yuv420p" : "yuv411p");
- opt_frame_rate("r", frame_rates[norm]);
+ parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
+ parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
+ norm == PAL ? "yuv420p" : "yuv411p", options);
+ parse_option(o, "r", frame_rates[norm], options);
- audio_sample_rate = 48000;
+ parse_option(o, "ar", "48000", options);
parse_option(o, "ac", "2", options);
} else {
@@ -4293,6 +4180,10 @@ static int opt_old2new(OptionsContext *o, const char *opt, const char *arg){
return parse_option(o, s, arg, options);
}
+static int opt_video_filters(OptionsContext *o, const char *opt, const char *arg)
+{
+ return parse_option(o, "filter:v", arg, options);
+}
#define OFFSET(x) offsetof(OptionsContext, x)
static const OptionDef options[] = {
@@ -4329,7 +4220,6 @@ static const OptionDef options[] = {
{ "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "deprecated, use -loop", "" },
{ "v", HAS_ARG, {(void*)opt_verbose}, "set the verbosity level", "number" },
{ "target", HAS_ARG | OPT_FUNC2, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
- { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
{ "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
@@ -4337,18 +4227,22 @@ static const OptionDef options[] = {
{ "copytb", OPT_BOOL | OPT_EXPERT, {(void*)&copy_tb}, "copy input stream time base when stream copying" },
{ "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, //
{ "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" },
- { "programid", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&opt_programid}, "desired program number", "" },
{ "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },
{ "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },
{ "frames", OPT_INT64 | HAS_ARG | OPT_SPEC, {.off = OFFSET(max_frames)}, "set the number of frames to record", "number" },
{ "tag", OPT_STRING | HAS_ARG | OPT_SPEC, {.off = OFFSET(codec_tags)}, "force codec tag/fourcc", "fourcc/tag" },
+ { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(qscale)}, "use fixed quality scale (VBR)", "q" },
+ { "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(qscale)}, "use fixed quality scale (VBR)", "q" },
+#if CONFIG_AVFILTER
+ { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" },
+#endif
/* video options */
{ "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" },
- { "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
- { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
- { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
+ { "r", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_rates)}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
+ { "s", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_sizes)}, "set frame size (WxH or abbreviation)", "size" },
+ { "aspect", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_aspect_ratios)}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
+ { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_pix_fmts)}, "set pixel format", "format" },
{ "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&frame_bits_per_raw_sample}, "set the number of bits per raw sample", "number" },
{ "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
{ "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
@@ -4362,42 +4256,40 @@ static const OptionDef options[] = {
{ "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
{ "vn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET, {.off = OFFSET(video_disable)}, "disable video" },
{ "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
- { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
- { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
+ { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(rc_overrides)}, "rate control override for specific intervals", "override" },
{ "vcodec", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
- { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimation threshold", "threshold" },
{ "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quant}, "use same quantizer as source (implies VBR)" },
- { "same_quant", OPT_BOOL | OPT_VIDEO, {(void*)&same_quant}, "use same quantizer as source (implies VBR)" },
+ { "same_quant", OPT_BOOL | OPT_VIDEO, {(void*)&same_quant},
+ "use same quantizer as source (implies VBR)" },
{ "pass", HAS_ARG | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
{ "passlogfile", HAS_ARG | OPT_VIDEO, {(void*)&opt_passlogfile}, "select two pass log file name prefix", "prefix" },
{ "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
"deinterlace pictures" },
- { "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
{ "vstats", OPT_EXPERT | OPT_VIDEO, {(void*)&opt_vstats}, "dump video coding statistics to file" },
{ "vstats_file", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_vstats_file}, "dump video coding statistics to file", "file" },
#if CONFIG_AVFILTER
- { "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
+ { "vf", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_filters}, "video filters", "filter list" },
#endif
- { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
- { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
- { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
+ { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(intra_matrices)}, "specify intra matrix coeffs", "matrix" },
+ { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(inter_matrices)}, "specify inter matrix coeffs", "matrix" },
+ { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_INT| OPT_SPEC, {.off = OFFSET(top_field_first)}, "top=1/bottom=0/auto=-1 field first", "" },
{ "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
{ "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_FUNC2, {(void*)opt_old2new}, "force video tag/fourcc", "fourcc/tag" },
{ "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
- { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" },
- { "streamid", HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
- { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" },
+ { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(force_fps)}, "force the selected framerate, disable the best supported framerate selection" },
+ { "streamid", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
+ { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(forced_key_frames)}, "force key frames at specified timestamps", "timestamps" },
/* audio options */
{ "aframes", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_frames}, "set the number of audio frames to record", "number" },
- { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
- { "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
+ { "aq", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_qscale}, "set audio quality (codec-specific)", "quality", },
+ { "ar", HAS_ARG | OPT_AUDIO | OPT_INT | OPT_SPEC, {.off = OFFSET(audio_sample_rate)}, "set audio sampling rate (in Hz)", "rate" },
{ "ac", HAS_ARG | OPT_AUDIO | OPT_INT | OPT_SPEC, {.off = OFFSET(audio_channels)}, "set number of audio channels", "channels" },
{ "an", OPT_BOOL | OPT_AUDIO | OPT_OFFSET, {.off = OFFSET(audio_disable)}, "disable audio" },
{ "acodec", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
{ "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_FUNC2, {(void*)opt_old2new}, "force audio tag/fourcc", "fourcc/tag" },
{ "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
- { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" },
+ { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_SPEC | OPT_STRING, {.off = OFFSET(sample_fmts)}, "set sample format", "format" },
/* subtitle options */
{ "sn", OPT_BOOL | OPT_SUBTITLE | OPT_OFFSET, {.off = OFFSET(subtitle_disable)}, "disable subtitle" },