#include "avformat.h"
#include "framehook.h"
#include "dsputil.h"
+#include "opt.h"
#ifndef CONFIG_WIN32
#include <unistd.h>
static void show_help(void);
static void show_license(void);
+static int opt_default(const char *opt, const char *arg);
#define MAX_FILES 20
static int video_mb_lmin = 2*FF_QP2LAMBDA;
static int video_mb_lmax = 31*FF_QP2LAMBDA;
static int video_qdiff = 3;
-static int video_lelim = 0;
-static int video_celim = 0;
static float video_qblur = 0.5;
static float video_qsquish = 0.0;
static float video_qcomp = 0.5;
static int same_quality = 0;
static int b_frames = 0;
static int b_strategy = 0;
-static int mb_decision = FF_MB_DECISION_SIMPLE;
-static int ildct_cmp = FF_CMP_VSAD;
-static int mb_cmp = FF_CMP_SAD;
-static int sub_cmp = FF_CMP_SAD;
-static int cmp = FF_CMP_SAD;
-static int pre_cmp = FF_CMP_SAD;
static int pre_me = 0;
-static float lumi_mask = 0;
-static float dark_mask = 0;
-static float scplx_mask = 0;
-static float tcplx_mask = 0;
-static float p_mask = 0;
-static int use_4mv = 0;
-static int use_obmc = 0;
-static int use_loop = 0;
-static int use_aic = 0;
-static int use_aiv = 0;
-static int use_umv = 0;
-static int use_ss = 0;
-static int use_alt_scan = 0;
-static int use_trell = 0;
-static int use_scan_offset = 0;
-static int use_qpel = 0;
-static int use_qprd = 0;
-static int use_cbprd = 0;
-static int use_mv0 = 0;
-static int do_normalize_aqp = 0;
-static int qns = 0;
-static int closed_gop = 0;
-static int strict_gop = 0;
-static int no_output = 0;
static int do_deinterlace = 0;
-static int do_interlace_dct = 0;
-static int do_interlace_me = 0;
static int workaround_bugs = FF_BUG_AUTODETECT;
-static int error_resilience = FF_ER_CAREFULL;
-static int error_concealment = 3;
-static int dct_algo = 0;
-static int idct_algo = 0;
-static int use_part = 0;
static int packet_size = 0;
static int error_rate = 0;
static int strict = 0;
static int top_field_first = -1;
-static int noise_reduction = 0;
static int sc_threshold = 0;
-static int debug = 0;
-static int debug_mv = 0;
static int me_threshold = 0;
static int mb_threshold = 0;
static int intra_dc_precision = 8;
-static int coder = 0;
-static int context = 0;
-static int predictor = 0;
-static int video_profile = FF_PROFILE_UNKNOWN;
-static int video_level = FF_LEVEL_UNKNOWN;
-static int nsse_weight = 8;
-static int subpel_quality= 8;
static int me_penalty_compensation= 256;
-static int lowres= 0;
static int frame_skip_threshold= 0;
static int frame_skip_factor= 0;
static int frame_skip_exp= 0;
-static int frame_skip_cmp= FF_CMP_DCTMAX;
extern int loop_input; /* currently a hack */
static int loop_output = AVFMT_NOOUTPUTLOOP;
-static int gray_only = 0;
static int genpts = 0;
static int gop_size = 12;
static int do_psnr = 0;
static int do_vstats = 0;
static int do_pass = 0;
-static int bitexact = 0;
static char *pass_logfilename = NULL;
static int audio_stream_copy = 0;
static int video_stream_copy = 0;
static int pgmyuv_compatibility_hack=0;
+const char **opt_names=NULL;
+int opt_name_count=0;
+AVCodecContext *avctx_opts;
+
#define DEFAULT_PASS_LOGFILENAME "ffmpeg2pass"
for(i=0;i<ic->nb_streams;i++) {
AVStream *st;
+ // FIXME: a more elegant solution is needed
st = av_mallocz(sizeof(AVStream));
memcpy(st, ic->streams[i], sizeof(AVStream));
+ st->codec = avcodec_alloc_context();
+ memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
s->streams[i] = st;
}
pkt.stream_index= ost->index;
pkt.data= audio_out;
pkt.size= ret;
- if(enc->coded_frame)
+ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= PKT_FLAG_KEY;
av_interleaved_write_frame(s, &pkt);
pkt.stream_index= ost->index;
pkt.data= audio_out;
pkt.size= ret;
- if(enc->coded_frame)
+ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= PKT_FLAG_KEY;
av_interleaved_write_frame(s, &pkt);
enc->coded_frame = dec->coded_frame; //FIXME/XXX remove this hack
pkt.data= (uint8_t *)final_picture;
pkt.size= sizeof(AVPicture);
- if(dec->coded_frame)
+ if(dec->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
if(dec->coded_frame && dec->coded_frame->key_frame)
pkt.flags |= PKT_FLAG_KEY;
/* better than nothing: use input picture interlaced
settings */
big_picture.interlaced_frame = in_picture->interlaced_frame;
- if(do_interlace_me || do_interlace_dct){
+ if(avctx_opts->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
if(top_field_first == -1)
big_picture.top_field_first = in_picture->top_field_first;
else
if(ret>0){
pkt.data= bit_buffer;
pkt.size= ret;
- if(enc->coded_frame)
+ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
/*av_log(NULL, AV_LOG_DEBUG, "encoder -> %lld/%lld\n",
pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1,
break;
pkt.data= bit_buffer;
pkt.size= ret;
- if(enc->coded_frame)
+ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
av_interleaved_write_frame(os, &pkt);
}
goto fail;
ost->img_resample_ctx = img_resample_full_init(
- ost->st->codec->width, ost->st->codec->height,
- ist->st->codec->width, ist->st->codec->height,
+ codec->width, codec->height,
+ icodec->width, icodec->height,
frame_topBand, frame_bottomBand,
frame_leftBand, frame_rightBand,
frame_padtop, frame_padbottom,
workaround_bugs = atoi(arg);
}
-static void opt_dct_algo(const char *arg)
-{
- dct_algo = atoi(arg);
-}
-
-static void opt_idct_algo(const char *arg)
-{
- idct_algo = atoi(arg);
-}
-
static void opt_me_threshold(const char *arg)
{
me_threshold = atoi(arg);
mb_threshold = atoi(arg);
}
-static void opt_error_resilience(const char *arg)
-{
- error_resilience = atoi(arg);
-}
-
-static void opt_error_concealment(const char *arg)
-{
- error_concealment = atoi(arg);
-}
-
-static void opt_debug(const char *arg)
-{
- debug = atoi(arg);
- av_log_set_level(AV_LOG_DEBUG);
-}
-
-static void opt_vismv(const char *arg)
-{
- debug_mv = atoi(arg);
-}
-
static void opt_verbose(const char *arg)
{
verbose = atoi(arg);
}
}
-static void opt_mb_decision(const char *arg)
-{
- mb_decision = atoi(arg);
-}
-
-static void opt_mb_cmp(const char *arg)
-{
- mb_cmp = atoi(arg);
-}
-
-static void opt_ildct_cmp(const char *arg)
-{
- ildct_cmp = atoi(arg);
-}
-
-static void opt_sub_cmp(const char *arg)
-{
- sub_cmp = atoi(arg);
-}
-
-static void opt_cmp(const char *arg)
-{
- cmp = atoi(arg);
-}
-
-static void opt_pre_cmp(const char *arg)
-{
- pre_cmp = atoi(arg);
-}
-
static void opt_pre_me(const char *arg)
{
pre_me = atoi(arg);
}
-static void opt_lumi_mask(const char *arg)
-{
- lumi_mask = atof(arg);
-}
-
-static void opt_dark_mask(const char *arg)
-{
- dark_mask = atof(arg);
-}
-
-static void opt_scplx_mask(const char *arg)
-{
- scplx_mask = atof(arg);
-}
-
-static void opt_tcplx_mask(const char *arg)
-{
- tcplx_mask = atof(arg);
-}
-
-static void opt_p_mask(const char *arg)
-{
- p_mask = atof(arg);
-}
-
static void opt_qscale(const char *arg)
{
video_qscale = atof(arg);
}
}
-static void opt_lelim(const char *arg)
-{
- video_lelim = atoi(arg);
- if (video_lelim < -99 ||
- video_lelim > 99) {
- fprintf(stderr, "lelim must be >= -99 and <= 99\n");
- exit(1);
- }
-}
-
-static void opt_celim(const char *arg)
-{
- video_celim = atoi(arg);
- if (video_celim < -99 ||
- video_celim > 99) {
- fprintf(stderr, "celim must be >= -99 and <= 99\n");
- exit(1);
- }
-}
-
static void opt_lmax(const char *arg)
{
video_lmax = atof(arg)*FF_QP2LAMBDA;
top_field_first= atoi(arg);
}
-static void opt_noise_reduction(const char *arg)
-{
- noise_reduction= atoi(arg);
-}
-
-static void opt_qns(const char *arg)
-{
- qns= atoi(arg);
-}
-
static void opt_sc_threshold(const char *arg)
{
sc_threshold= atoi(arg);
/* update the current parameters so that they match the one of the input stream */
for(i=0;i<ic->nb_streams;i++) {
+ int j;
AVCodecContext *enc = ic->streams[i]->codec;
#if defined(HAVE_THREADS)
if(thread_count>1)
enc->thread_count= thread_count;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
+ for(j=0; j<opt_name_count; j++){
+ AVOption *opt;
+ double d= av_get_double(avctx_opts, opt_names[j], &opt);
+ if(d==d && (opt->flags&AV_OPT_FLAG_AUDIO_PARAM) && (opt->flags&AV_OPT_FLAG_DECODING_PARAM))
+ av_set_double(enc, opt_names[j], d);
+ }
//fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
audio_channels = enc->channels;
audio_sample_rate = enc->sample_rate;
ic->streams[i]->discard= AVDISCARD_ALL;
break;
case CODEC_TYPE_VIDEO:
+ for(j=0; j<opt_name_count; j++){
+ AVOption *opt;
+ double d= av_get_double(avctx_opts, opt_names[j], &opt);
+ if(d==d && (opt->flags&AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags&AV_OPT_FLAG_DECODING_PARAM))
+ av_set_double(enc, opt_names[j], d);
+ }
frame_height = enc->height;
frame_width = enc->width;
frame_aspect_ratio = av_q2d(enc->sample_aspect_ratio) * enc->width / enc->height;
rfps = ic->streams[i]->r_frame_rate.num;
rfps_base = ic->streams[i]->r_frame_rate.den;
enc->workaround_bugs = workaround_bugs;
- enc->error_resilience = error_resilience;
- enc->error_concealment = error_concealment;
- enc->idct_algo = idct_algo;
- enc->debug = debug;
- enc->debug_mv = debug_mv;
- enc->lowres= lowres;
- if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE;
- if(bitexact)
- enc->flags|= CODEC_FLAG_BITEXACT;
+ if(enc->lowres) enc->flags |= CODEC_FLAG_EMU_EDGE;
if(me_threshold)
enc->debug |= FF_DEBUG_MV;
- if(gray_only)
- enc->flags |= CODEC_FLAG_GRAY;
if (enc->time_base.den != rfps || enc->time_base.num != rfps_base) {
video_enc->codec_tag= video_codec_tag;
if( (video_global_header&1)
- || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER)))
+ || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
- if(video_global_header&2)
+ avctx_opts->flags|= CODEC_FLAG_GLOBAL_HEADER;
+ }
+ if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
+ avctx_opts->flags2|= CODEC_FLAG2_LOCAL_HEADER;
+ }
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_id = codec_id;
codec = avcodec_find_encoder(codec_id);
+
+ for(i=0; i<opt_name_count; i++){
+ AVOption *opt;
+ double d= av_get_double(avctx_opts, opt_names[i], &opt);
+ if(d==d && (opt->flags&AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM))
+ av_set_double(video_enc, opt_names[i], d);
+ }
video_enc->bit_rate = video_bit_rate;
video_enc->bit_rate_tolerance = video_bit_rate_tolerance;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
- if(bitexact)
- video_enc->flags |= CODEC_FLAG_BITEXACT;
-
- video_enc->mb_decision = mb_decision;
- video_enc->mb_cmp = mb_cmp;
- video_enc->ildct_cmp = ildct_cmp;
- video_enc->me_sub_cmp = sub_cmp;
- video_enc->me_cmp = cmp;
- video_enc->me_pre_cmp = pre_cmp;
video_enc->pre_me = pre_me;
- video_enc->lumi_masking = lumi_mask;
- video_enc->dark_masking = dark_mask;
- video_enc->spatial_cplx_masking = scplx_mask;
- video_enc->temporal_cplx_masking = tcplx_mask;
- video_enc->p_masking = p_mask;
- video_enc->quantizer_noise_shaping= qns;
- if (use_umv) {
- video_enc->flags |= CODEC_FLAG_H263P_UMV;
- }
- if (use_ss) {
- video_enc->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
- }
- if (use_aic) {
- video_enc->flags |= CODEC_FLAG_H263P_AIC;
- }
- if (use_aiv) {
- video_enc->flags |= CODEC_FLAG_H263P_AIV;
- }
- if (use_4mv) {
- video_enc->flags |= CODEC_FLAG_4MV;
- }
- if (use_obmc) {
- video_enc->flags |= CODEC_FLAG_OBMC;
- }
- if (use_loop) {
- video_enc->flags |= CODEC_FLAG_LOOP_FILTER;
- }
-
- if(use_part) {
- video_enc->flags |= CODEC_FLAG_PART;
- }
- if (use_alt_scan) {
- video_enc->flags |= CODEC_FLAG_ALT_SCAN;
- }
- if (use_trell) {
- video_enc->flags |= CODEC_FLAG_TRELLIS_QUANT;
- }
- if (use_mv0) {
- video_enc->flags |= CODEC_FLAG_MV0;
- }
- if (do_normalize_aqp) {
- video_enc->flags |= CODEC_FLAG_NORMALIZE_AQP;
- }
- if (use_scan_offset) {
- video_enc->flags |= CODEC_FLAG_SVCD_SCAN_OFFSET;
- }
- if (closed_gop) {
- video_enc->flags |= CODEC_FLAG_CLOSED_GOP;
- }
- if (strict_gop) {
- video_enc->flags2 |= CODEC_FLAG2_STRICT_GOP;
- }
- if (use_qpel) {
- video_enc->flags |= CODEC_FLAG_QPEL;
- }
- if (use_qprd) {
- video_enc->flags |= CODEC_FLAG_QP_RD;
- }
- if (use_cbprd) {
- video_enc->flags |= CODEC_FLAG_CBP_RD;
- }
if (b_frames) {
video_enc->max_b_frames = b_frames;
video_enc->b_frame_strategy = b_strategy;
video_enc->b_quant_factor = 2.0;
}
- if (do_interlace_dct) {
- video_enc->flags |= CODEC_FLAG_INTERLACED_DCT;
- }
- if (do_interlace_me) {
- video_enc->flags |= CODEC_FLAG_INTERLACED_ME;
- }
- if (no_output) {
- video_enc->flags2 |= CODEC_FLAG2_NO_OUTPUT;
- }
- if (gray_only) {
- video_enc->flags |= CODEC_FLAG_GRAY;
- }
video_enc->qmin = video_qmin;
video_enc->qmax = video_qmax;
video_enc->lmin = video_lmin;
video_enc->lmax = video_lmax;
video_enc->rc_qsquish = video_qsquish;
- video_enc->luma_elim_threshold = video_lelim;
- video_enc->chroma_elim_threshold = video_celim;
video_enc->mb_lmin = video_mb_lmin;
video_enc->mb_lmax = video_mb_lmax;
video_enc->max_qdiff = video_qdiff;
video_enc->qblur = video_qblur;
video_enc->qcompress = video_qcomp;
video_enc->rc_eq = video_rc_eq;
- video_enc->debug = debug;
- video_enc->debug_mv = debug_mv;
video_enc->workaround_bugs = workaround_bugs;
video_enc->thread_count = thread_count;
p= video_rc_override_string;
video_enc->b_quant_offset = video_b_qoffset;
video_enc->intra_quant_bias = video_intra_quant_bias;
video_enc->inter_quant_bias = video_inter_quant_bias;
- video_enc->dct_algo = dct_algo;
- video_enc->idct_algo = idct_algo;
video_enc->me_threshold= me_threshold;
video_enc->mb_threshold= mb_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
video_enc->strict_std_compliance = strict;
video_enc->error_rate = error_rate;
- video_enc->noise_reduction= noise_reduction;
video_enc->scenechange_threshold= sc_threshold;
video_enc->me_range = me_range;
- video_enc->coder_type= coder;
- video_enc->context_model= context;
- video_enc->prediction_method= predictor;
- video_enc->profile= video_profile;
- video_enc->level= video_level;
- video_enc->nsse_weight= nsse_weight;
- video_enc->me_subpel_quality= subpel_quality;
video_enc->me_penalty_compensation= me_penalty_compensation;
video_enc->frame_skip_threshold= frame_skip_threshold;
video_enc->frame_skip_factor= frame_skip_factor;
video_enc->frame_skip_exp= frame_skip_exp;
- video_enc->frame_skip_cmp= frame_skip_cmp;
if(packet_size){
video_enc->rtp_mode= 1;
{
AVStream *st;
AVCodecContext *audio_enc;
- int codec_id;
+ int codec_id, i;
st = av_new_stream(oc, oc->nb_streams);
if (!st) {
if(audio_codec_tag)
audio_enc->codec_tag= audio_codec_tag;
- if (oc->oformat->flags & AVFMT_GLOBALHEADER)
+ if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ avctx_opts->flags|= CODEC_FLAG_GLOBAL_HEADER;
+ }
if (audio_stream_copy) {
st->stream_copy = 1;
audio_enc->channels = audio_channels;
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_AUDIO);
+
+ for(i=0; i<opt_name_count; i++){
+ AVOption *opt;
+ double d= av_get_double(avctx_opts, opt_names[i], &opt);
+ if(d==d && (opt->flags&AV_OPT_FLAG_AUDIO_PARAM) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM))
+ av_set_double(audio_enc, opt_names[i], d);
+ }
+
if (audio_codec_id != CODEC_ID_NONE)
codec_id = audio_codec_id;
audio_enc->codec_id = codec_id;
AVFormatContext *oc;
AVStream *st;
AVCodecContext *subtitle_enc;
+ int i;
if (nb_output_files <= 0) {
fprintf(stderr, "At least one output file must be specified\n");
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
+ for(i=0; i<opt_name_count; i++){
+ AVOption *opt;
+ double d= av_get_double(avctx_opts, opt_names[i], &opt);
+ if(d==d && (opt->flags&AV_OPT_FLAG_SUBTITLE_PARAM) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM))
+ av_set_double(subtitle_enc, opt_names[i], d);
+ }
subtitle_enc->codec_id = subtitle_codec_id;
}
extern int ffm_nopts;
-static void opt_bitexact(void)
-{
- bitexact=1;
- /* disable generate of real time pts in ffm (need to be supressed anyway) */
- ffm_nopts = 1;
-}
-
static void show_formats(void)
{
AVInputFormat *ifmt;
video_rc_max_rate = 2516000;
video_rc_min_rate = 0; //1145000;
video_rc_buffer_size = 224*1024*8;
- use_scan_offset = 1;
+ opt_default("flags", "+SCAN_OFFSET");
+
audio_bit_rate = 224000;
audio_sample_rate = 44100;
exit(1);
}
+static int opt_default(const char *opt, const char *arg){
+ AVOption *o= av_set_string(avctx_opts, opt, arg);
+ if(!o)
+ return -1;
+
+// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avctx_opts, opt, NULL), (int)av_get_int(avctx_opts, opt, NULL));
+
+ //FIXME we should always use avctx_opts, ... for storing options so there wont be any need to keep track of whats set over this
+ opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
+ opt_names[opt_name_count++]= o->name;
+
+ /* disable generate of real time pts in ffm (need to be supressed anyway) */
+ if(avctx_opts->flags & CODEC_FLAG_BITEXACT)
+ ffm_nopts = 1;
+
+ if(avctx_opts->debug)
+ av_log_set_level(AV_LOG_DEBUG);
+ return 0;
+}
+
const OptionDef options[] = {
/* main options */
{ "L", 0, {(void*)show_license}, "show license" },
{ "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" },
{ "copyright", HAS_ARG | OPT_STRING, {(void*)&str_copyright}, "set the copyright", "string" },
{ "comment", HAS_ARG | OPT_STRING, {(void*)&str_comment}, "set the comment", "string" },
- { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
- { "vismv", HAS_ARG | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" },
{ "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
"add timings for benchmarking" },
{ "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump},
"dump each input packet" },
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
"when dumping packets, also dump the payload" },
- { "bitexact", OPT_EXPERT, {(void*)opt_bitexact}, "only use bit exact algorithms (for codec testing)" },
{ "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" },
{ "loop", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" },
{ "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" },
{ "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
{ "me", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_motion_estimation}, "set motion estimation method",
"method" },
- { "dct_algo", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_dct_algo}, "set dct algo", "algo" },
- { "idct_algo", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_idct_algo}, "set idct algo", "algo" },
{ "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "" },
{ "mb_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_threshold}, "macroblock threshold", "" },
- { "er", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_error_resilience}, "set error resilience", "n" },
- { "ec", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_error_concealment}, "set error concealment", "bit_mask" },
{ "bf", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_b_frames}, "use 'frames' B frames", "frames" },
- { "hq", OPT_BOOL, {(void*)&mb_decision}, "activate high quality settings" },
- { "mbd", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_decision}, "macroblock decision", "mode" },
- { "mbcmp", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_cmp}, "macroblock compare function", "cmp function" },
- { "ildctcmp", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_ildct_cmp}, "ildct compare function", "cmp function" },
- { "subcmp", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_sub_cmp}, "subpel compare function", "cmp function" },
- { "cmp", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_cmp}, "fullpel compare function", "cmp function" },
- { "precmp", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_pre_cmp}, "pre motion estimation compare function", "cmp function" },
{ "preme", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_pre_me}, "pre motion estimation", "" },
- { "lelim", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lelim}, "single coefficient elimination threshold for luminance (negative values also consider DC coefficient)", "elim" },
- { "celim", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_celim}, "single coefficient elimination threshold for chrominance (negative values also consider DC coefficient)", "elim" },
- { "lumi_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lumi_mask}, "luminance masking", "" },
- { "dark_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_dark_mask}, "darkness masking", "" },
- { "scplx_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_scplx_mask}, "spatial complexity masking", "" },
- { "tcplx_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_tcplx_mask}, "temporal complexity masking", "" },
- { "p_mask", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_p_mask}, "inter masking", "" },
- { "4mv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_4mv}, "use four motion vector by macroblock (MPEG4)" },
- { "obmc", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_obmc}, "use overlapped block motion compensation (h263+)" },
- { "lf", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_loop}, "use loop filter (h263+)" },
- { "part", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_part}, "use data partitioning (MPEG4)" },
{ "bug", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_workaround_bugs}, "workaround not auto detected encoder bugs", "param" },
{ "ps", HAS_ARG | OPT_EXPERT, {(void*)opt_packet_size}, "set packet size in bits", "size" },
{ "error", HAS_ARG | OPT_EXPERT, {(void*)opt_error_rate}, "error rate", "rate" },
{ "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename}, "select two pass log file name", "file" },
{ "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
"deinterlace pictures" },
- { "ildct", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_interlace_dct},
- "force interlaced dct support in encoder (MPEG2/MPEG4)" },
- { "ilme", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_interlace_me},
- "force interlaced me support in encoder (MPEG2/MPEG4)" },
{ "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
{ "vstats", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_vstats}, "dump video coding statistics to file" },
{ "vhook", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)add_frame_hooker}, "insert video processing module", "module" },
- { "aic", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_aic}, "enable Advanced intra coding (h263+)" },
- { "aiv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_aiv}, "enable Alternative inter vlc (h263+)" },
- { "umv", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_umv}, "enable Unlimited Motion Vector (h263+)" },
- { "ssm", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_ss}, "enable Slice Structured mode (h263+)" },
- { "alt", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_alt_scan}, "enable alternate scantable (MPEG2/MPEG4)" },
- { "qprd", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_qprd}, "" },
- { "cbp", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_cbprd}, "" },
- { "trell", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_trell}, "enable trellis quantization" },
- { "mv0", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_mv0}, "try to encode each MB with MV=<0,0> and choose the better one (has no effect if mbd=0)" },
- { "naq", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_normalize_aqp}, "normalize adaptive quantization" },
- { "cgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&closed_gop}, "closed gop" },
- { "sgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&strict_gop}, "strict gop" },
- { "noout", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&no_output}, "skip bitstream encoding" },
- { "scan_offset", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_scan_offset}, "enable SVCD Scan Offset placeholder" },
- { "qpel", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_qpel}, "enable 1/4-pel" },
{ "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", "" },
- { "nr", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_noise_reduction}, "noise reduction", "" },
- { "qns", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qns}, "quantization noise shaping", "" },
{ "sc_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_sc_threshold}, "scene change threshold", "threshold" },
{ "me_range", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_range}, "limit motion vectors range (1023 for DivX player)", "range" },
{ "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
- { "coder", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&coder}, "coder type", "" },
- { "context", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&context}, "context model", "" },
- { "pred", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&predictor}, "prediction method", "" },
- { "vprofile", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_profile}, "profile", "" },
- { "vlevel", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_level}, "level", "" },
- { "nssew", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&nsse_weight}, "weight", "" },
- { "subq", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&subpel_quality}, "", "" },
{ "mepc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&me_penalty_compensation}, "motion estimation bitrate penalty compensation", "factor (1.0 = 256)" },
- { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&lowres}, "", "" },
{ "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
{ "skip_threshold", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_threshold}, "frame skip threshold", "threshold" },
{ "skip_factor", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_factor}, "frame skip factor", "factor" },
{ "skip_exp", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_exp}, "frame skip exponent", "exponent" },
- { "skip_cmp", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_cmp}, "frame skip compare function", "compare function" },
- { "gray", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&gray_only }, "encode/decode grayscale" },
{ "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" },
{ "genpts", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&genpts }, "generate pts" },
{ "packetsize", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&mux_packet_size}, "set packet size", "size" },
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" },
{ "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" },
+ { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ NULL, },
};
show_help_options(options, "\nAdvanced options:\n",
OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
OPT_EXPERT);
+ av_opt_show(avctx_opts, NULL);
+
exit(1);
}
int64_t ti;
av_register_all();
+
+ avctx_opts= avcodec_alloc_context();
if (argc <= 1)
show_help();