+ { "help", no_argument, NULL, 'h' },
+ { "longhelp", no_argument, NULL, OPT_LONGHELP },
+ { "fullhelp", no_argument, NULL, OPT_FULLHELP },
+ { "version", no_argument, NULL, 'V' },
+ { "profile", required_argument, NULL, OPT_PROFILE },
+ { "preset", required_argument, NULL, OPT_PRESET },
+ { "tune", required_argument, NULL, OPT_TUNE },
+ { "slow-firstpass", no_argument, NULL, OPT_SLOWFIRSTPASS },
+ { "bitrate", required_argument, NULL, 'B' },
+ { "bframes", required_argument, NULL, 'b' },
+ { "b-adapt", required_argument, NULL, 0 },
+ { "no-b-adapt", no_argument, NULL, 0 },
+ { "b-bias", required_argument, NULL, 0 },
+ { "b-pyramid", required_argument, NULL, 0 },
+ { "min-keyint", required_argument, NULL, 'i' },
+ { "keyint", required_argument, NULL, 'I' },
+ { "intra-refresh", no_argument, NULL, 0 },
+ { "scenecut", required_argument, NULL, 0 },
+ { "no-scenecut", no_argument, NULL, 0 },
+ { "nf", no_argument, NULL, 0 },
+ { "no-deblock", no_argument, NULL, 0 },
+ { "filter", required_argument, NULL, 0 },
+ { "deblock", required_argument, NULL, 'f' },
+ { "interlaced", no_argument, NULL, OPT_INTERLACED },
+ { "tff", no_argument, NULL, OPT_INTERLACED },
+ { "bff", no_argument, NULL, OPT_INTERLACED },
+ { "no-interlaced", no_argument, NULL, OPT_INTERLACED },
+ { "constrained-intra", no_argument, NULL, 0 },
+ { "cabac", no_argument, NULL, 0 },
+ { "no-cabac", no_argument, NULL, 0 },
+ { "qp", required_argument, NULL, 'q' },
+ { "qpmin", required_argument, NULL, 0 },
+ { "qpmax", required_argument, NULL, 0 },
+ { "qpstep", required_argument, NULL, 0 },
+ { "crf", required_argument, NULL, 0 },
+ { "rc-lookahead",required_argument, NULL, 0 },
+ { "ref", required_argument, NULL, 'r' },
+ { "asm", required_argument, NULL, 0 },
+ { "no-asm", no_argument, NULL, 0 },
+ { "sar", required_argument, NULL, 0 },
+ { "fps", required_argument, NULL, OPT_FPS },
+ { "frames", required_argument, NULL, OPT_FRAMES },
+ { "seek", required_argument, NULL, OPT_SEEK },
+ { "output", required_argument, NULL, 'o' },
+ { "muxer", required_argument, NULL, OPT_MUXER },
+ { "demuxer", required_argument, NULL, OPT_DEMUXER },
+ { "stdout", required_argument, NULL, OPT_MUXER },
+ { "stdin", required_argument, NULL, OPT_DEMUXER },
+ { "index", required_argument, NULL, OPT_INDEX },
+ { "analyse", required_argument, NULL, 0 },
+ { "partitions", required_argument, NULL, 'A' },
+ { "direct", required_argument, NULL, 0 },
+ { "weightb", no_argument, NULL, 'w' },
+ { "no-weightb", no_argument, NULL, 0 },
+ { "weightp", required_argument, NULL, 0 },
+ { "me", required_argument, NULL, 0 },
+ { "merange", required_argument, NULL, 0 },
+ { "mvrange", required_argument, NULL, 0 },
+ { "mvrange-thread", required_argument, NULL, 0 },
+ { "subme", required_argument, NULL, 'm' },
+ { "psy-rd", required_argument, NULL, 0 },
+ { "no-psy", no_argument, NULL, 0 },
+ { "psy", no_argument, NULL, 0 },
+ { "mixed-refs", no_argument, NULL, 0 },
+ { "no-mixed-refs", no_argument, NULL, 0 },
+ { "no-chroma-me", no_argument, NULL, 0 },
+ { "8x8dct", no_argument, NULL, 0 },
+ { "no-8x8dct", no_argument, NULL, 0 },
+ { "trellis", required_argument, NULL, 't' },
+ { "fast-pskip", no_argument, NULL, 0 },
+ { "no-fast-pskip", no_argument, NULL, 0 },
+ { "no-dct-decimate", no_argument, NULL, 0 },
+ { "aq-strength", required_argument, NULL, 0 },
+ { "aq-mode", required_argument, NULL, 0 },
+ { "deadzone-inter", required_argument, NULL, '0' },
+ { "deadzone-intra", required_argument, NULL, '0' },
+ { "level", required_argument, NULL, 0 },
+ { "ratetol", required_argument, NULL, 0 },
+ { "vbv-maxrate", required_argument, NULL, 0 },
+ { "vbv-bufsize", required_argument, NULL, 0 },
+ { "vbv-init", required_argument, NULL, 0 },
+ { "crf-max", required_argument, NULL, 0 },
+ { "ipratio", required_argument, NULL, 0 },
+ { "pbratio", required_argument, NULL, 0 },
+ { "chroma-qp-offset", required_argument, NULL, 0 },
+ { "pass", required_argument, NULL, 'p' },
+ { "stats", required_argument, NULL, 0 },
+ { "qcomp", required_argument, NULL, 0 },
+ { "mbtree", no_argument, NULL, 0 },
+ { "no-mbtree", no_argument, NULL, 0 },
+ { "qblur", required_argument, NULL, 0 },
+ { "cplxblur", required_argument, NULL, 0 },
+ { "zones", required_argument, NULL, 0 },
+ { "qpfile", required_argument, NULL, OPT_QPFILE },
+ { "threads", required_argument, NULL, 0 },
+ { "sliced-threads", no_argument, NULL, 0 },
+ { "no-sliced-threads", no_argument, NULL, 0 },
+ { "slice-max-size", required_argument, NULL, 0 },
+ { "slice-max-mbs", required_argument, NULL, 0 },
+ { "slices", required_argument, NULL, 0 },
+ { "thread-input", no_argument, NULL, OPT_THREAD_INPUT },
+ { "sync-lookahead", required_argument, NULL, 0 },
+ { "non-deterministic", no_argument, NULL, 0 },
+ { "psnr", no_argument, NULL, 0 },
+ { "ssim", no_argument, NULL, 0 },
+ { "quiet", no_argument, NULL, OPT_QUIET },
+ { "verbose", no_argument, NULL, 'v' },
+ { "no-progress", no_argument, NULL, OPT_NOPROGRESS },
+ { "visualize", no_argument, NULL, OPT_VISUALIZE },
+ { "dump-yuv", required_argument, NULL, 0 },
+ { "sps-id", required_argument, NULL, 0 },
+ { "aud", no_argument, NULL, 0 },
+ { "nr", required_argument, NULL, 0 },
+ { "cqm", required_argument, NULL, 0 },
+ { "cqmfile", required_argument, NULL, 0 },
+ { "cqm4", required_argument, NULL, 0 },
+ { "cqm4i", required_argument, NULL, 0 },
+ { "cqm4iy", required_argument, NULL, 0 },
+ { "cqm4ic", required_argument, NULL, 0 },
+ { "cqm4p", required_argument, NULL, 0 },
+ { "cqm4py", required_argument, NULL, 0 },
+ { "cqm4pc", required_argument, NULL, 0 },
+ { "cqm8", required_argument, NULL, 0 },
+ { "cqm8i", required_argument, NULL, 0 },
+ { "cqm8p", required_argument, NULL, 0 },
+ { "overscan", required_argument, NULL, 0 },
+ { "videoformat", required_argument, NULL, 0 },
+ { "fullrange", required_argument, NULL, 0 },
+ { "colorprim", required_argument, NULL, 0 },
+ { "transfer", required_argument, NULL, 0 },
+ { "colormatrix", required_argument, NULL, 0 },
+ { "chromaloc", required_argument, NULL, 0 },
+ { "force-cfr", no_argument, NULL, 0 },
+ { "tcfile-in", required_argument, NULL, OPT_TCFILE_IN },
+ { "tcfile-out", required_argument, NULL, OPT_TCFILE_OUT },
+ { "timebase", required_argument, NULL, OPT_TIMEBASE },
+ { "pic-struct", no_argument, NULL, 0 },
+ { "nal-hrd", required_argument, NULL, 0 },
+ { "pulldown", required_argument, NULL, OPT_PULLDOWN },
+ { "fake-interlaced", no_argument, NULL, 0 },
+ {0, 0, 0, 0}
+};
+
+static int select_output( const char *muxer, char *filename, x264_param_t *param )
+{
+ const char *ext = get_filename_extension( filename );
+ if( !strcmp( filename, "-" ) || strcasecmp( muxer, "auto" ) )
+ ext = muxer;
+
+ if( !strcasecmp( ext, "mp4" ) )
+ {
+#ifdef MP4_OUTPUT
+ output = mp4_output;
+ param->b_annexb = 0;
+ param->b_dts_compress = 0;
+ param->b_repeat_headers = 0;
+ if( param->i_nal_hrd == X264_NAL_HRD_CBR )