From: Fiona Glaser Date: Sun, 6 Sep 2009 21:55:48 +0000 (-0700) Subject: Improve x264 help X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02e662e1818a7b83c3f8120b06ccbaa378a7c58e;p=libx264 Improve x264 help Now has three help options: --help, --longhelp, and --fullhelp. --help only shows the most basic options; most users should not need more than these. Add usage examples. Fix typo in a comment. --- diff --git a/encoder/me.c b/encoder/me.c index 72a2cc56..eb0fd5a0 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -1146,7 +1146,7 @@ void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int } } - /* square refine, same as pattern as ME HEX. */ + /* square refine, same pattern as ME HEX. */ omx = bmx; omy = bmy; for( i=0; i<8; i++ ) COST_MV_SATD( omx + square1[i+1][0], omy + square1[i+1][1], satds[i], 1 ); diff --git a/x264.c b/x264.c index 0ed538a0..08095d59 100644 --- a/x264.c +++ b/x264.c @@ -77,7 +77,7 @@ static int (*p_write_nalu)( hnd_t handle, uint8_t *p_nal, int i_size ); static int (*p_set_eop)( hnd_t handle, x264_picture_t *p_picture ); static int (*p_close_outfile)( hnd_t handle ); -static void Help( x264_param_t *defaults, int b_longhelp ); +static void Help( x264_param_t *defaults, int longhelp ); static int Parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt ); static int Encode( x264_param_t *param, cli_opt_t *opt ); @@ -129,10 +129,11 @@ static char const *strtable_lookup( const char * const table[], int index ) /***************************************************************************** * Help: *****************************************************************************/ -static void Help( x264_param_t *defaults, int b_longhelp ) +static void Help( x264_param_t *defaults, int longhelp ) { #define H0 printf -#define H1 if(b_longhelp) printf +#define H1 if(longhelp>=1) printf +#define H2 if(longhelp==2) printf H0( "x264 core:%d%s\n" "Syntax: x264 [options] -o outfile infile [widthxheight]\n" "\n" @@ -146,8 +147,9 @@ static void Help( x264_param_t *defaults, int b_longhelp ) "\n" "Options:\n" "\n" - " -h, --help List the more commonly used options\n" - " --longhelp List all options\n" + " -h, --help List basic options\n" + " --longhelp List more options\n" + " --fullhelp List all options\n" "\n", X264_BUILD, X264_VERSION, #ifdef AVIS_INPUT @@ -161,6 +163,24 @@ static void Help( x264_param_t *defaults, int b_longhelp ) "no" #endif ); + H0( "Example usage:\n" ); + H0( "\n" ); + H0( " Constant quality mode:\n" ); + H0( " x264 --crf 24 -o output input\n" ); + H0( "\n" ); + H0( " Two-pass with a bitrate of 1000kbps:\n" ); + H0( " x264 --pass 1 --bitrate 1000 -o output input\n" ); + H0( " x264 --pass 2 --bitrate 1000 -o output input\n" ); + H0( "\n" ); + H0( " Lossless:\n" ); + H0( " x264 --crf 0 -o output input\n" ); + H0( "\n" ); + H0( " Maximum PSNR at the cost of speed and visual quality:\n" ); + H0( " x264 --preset placebo --tune psnr -o output input\n" ); + H0( "\n" ); + H0( " Constant bitrate at 1000kbps with a 2 second-buffer:\n"); + H0( " x264 --vbv-bufsize 2000 --bitrate 1000 -o output input\n" ); + H0( "\n" ); H0( "Presets:\n" ); H0( "\n" ); H0( " --profile Force H.264 profile [high]\n" ); @@ -172,72 +192,72 @@ static void Help( x264_param_t *defaults, int b_longhelp ) " - slow,slower,veryslow,placebo\n" ); H0( " --tune Tune the settings for a particular type of source\n" ); H0( " Overridden by user settings\n"); - H1( " - film,animation,grain,psnr,ssim\n" + H2( " - film,animation,grain,psnr,ssim\n" " - fastdecode,touhou\n"); else H0( " - film,animation,grain,psnr,ssim,fastdecode\n"); - H0( " --slow-firstpass Don't use faster settings with --pass 1\n" ); + H1( " --slow-firstpass Don't use faster settings with --pass 1\n" ); H0( "\n" ); H0( "Frame-type options:\n" ); H0( "\n" ); H0( " -I, --keyint Maximum GOP size [%d]\n", defaults->i_keyint_max ); - H1( " -i, --min-keyint Minimum GOP size [%d]\n", defaults->i_keyint_min ); - H1( " --no-scenecut Disable adaptive I-frame decision\n" ); - H1( " --scenecut How aggressively to insert extra I-frames [%d]\n", defaults->i_scenecut_threshold ); - H0( " -b, --bframes Number of B-frames between I and P [%d]\n", defaults->i_bframe ); + H2( " -i, --min-keyint Minimum GOP size [%d]\n", defaults->i_keyint_min ); + H2( " --no-scenecut Disable adaptive I-frame decision\n" ); + H2( " --scenecut How aggressively to insert extra I-frames [%d]\n", defaults->i_scenecut_threshold ); + H1( " -b, --bframes Number of B-frames between I and P [%d]\n", defaults->i_bframe ); H1( " --b-adapt Adaptive B-frame decision method [%d]\n" " Higher values may lower threading efficiency.\n" " - 0: Disabled\n" " - 1: Fast\n" " - 2: Optimal (slow with high --bframes)\n", defaults->i_bframe_adaptive ); - H1( " --b-bias Influences how often B-frames are used [%d]\n", defaults->i_bframe_bias ); - H0( " --b-pyramid Keep some B-frames as references\n" ); - H0( " --no-cabac Disable CABAC\n" ); - H0( " -r, --ref Number of reference frames [%d]\n", defaults->i_frame_reference ); + H2( " --b-bias Influences how often B-frames are used [%d]\n", defaults->i_bframe_bias ); + H1( " --b-pyramid Keep some B-frames as references\n" ); + H1( " --no-cabac Disable CABAC\n" ); + H1( " -r, --ref Number of reference frames [%d]\n", defaults->i_frame_reference ); H1( " --no-deblock Disable loop filter\n" ); - H0( " -f, --deblock Loop filter AlphaC0 and Beta parameters [%d:%d]\n", + H1( " -f, --deblock Loop filter parameters [%d:%d]\n", defaults->i_deblocking_filter_alphac0, defaults->i_deblocking_filter_beta ); - H1( " --slices Number of slices per frame; forces rectangular\n" + H2( " --slices Number of slices per frame; forces rectangular\n" " slices and is overridden by other slicing options\n" ); - H1( " --slice-max-size Limit the size of each slice in bytes\n"); - H1( " --slice-max-mbs Limit the size of each slice in macroblocks\n"); + else H1( " --slices Number of slices per frame\n" ); + H2( " --slice-max-size Limit the size of each slice in bytes\n"); + H2( " --slice-max-mbs Limit the size of each slice in macroblocks\n"); H0( " --interlaced Enable pure-interlaced mode\n" ); H0( "\n" ); H0( "Ratecontrol:\n" ); H0( "\n" ); - H0( " -q, --qp Set QP (0-51, 0=lossless)\n" ); + H1( " -q, --qp Force constant QP (0-51, 0=lossless)\n" ); H0( " -B, --bitrate Set bitrate (kbit/s)\n" ); H0( " --crf Quality-based VBR (0-51, 0=lossless) [%.1f]\n", defaults->rc.f_rf_constant ); - H0( " --rc-lookahead Number of frames for frametype lookahead [%d]\n", defaults->rc.i_lookahead ); + H1( " --rc-lookahead Number of frames for frametype lookahead [%d]\n", defaults->rc.i_lookahead ); H0( " --vbv-maxrate Max local bitrate (kbit/s) [%d]\n", defaults->rc.i_vbv_max_bitrate ); H0( " --vbv-bufsize Set size of the VBV buffer (kbit) [%d]\n", defaults->rc.i_vbv_buffer_size ); - H1( " --vbv-init Initial VBV buffer occupancy [%.1f]\n", defaults->rc.f_vbv_buffer_init ); - H1( " --qpmin Set min QP [%d]\n", defaults->rc.i_qp_min ); - H1( " --qpmax Set max QP [%d]\n", defaults->rc.i_qp_max ); - H1( " --qpstep Set max QP step [%d]\n", defaults->rc.i_qp_step ); - H0( " --ratetol Allowed variance of average bitrate [%.1f]\n", defaults->rc.f_rate_tolerance ); - H0( " --ipratio QP factor between I and P [%.2f]\n", defaults->rc.f_ip_factor ); - H0( " --pbratio QP factor between P and B [%.2f]\n", defaults->rc.f_pb_factor ); - H1( " --chroma-qp-offset QP difference between chroma and luma [%d]\n", defaults->analyse.i_chroma_qp_offset ); - H1( " --aq-mode AQ method [%d]\n" + H2( " --vbv-init Initial VBV buffer occupancy [%.1f]\n", defaults->rc.f_vbv_buffer_init ); + H2( " --qpmin Set min QP [%d]\n", defaults->rc.i_qp_min ); + H2( " --qpmax Set max QP [%d]\n", defaults->rc.i_qp_max ); + H2( " --qpstep Set max QP step [%d]\n", defaults->rc.i_qp_step ); + H2( " --ratetol Allowed variance of average bitrate [%.1f]\n", defaults->rc.f_rate_tolerance ); + H2( " --ipratio QP factor between I and P [%.2f]\n", defaults->rc.f_ip_factor ); + H2( " --pbratio QP factor between P and B [%.2f]\n", defaults->rc.f_pb_factor ); + H2( " --chroma-qp-offset QP difference between chroma and luma [%d]\n", defaults->analyse.i_chroma_qp_offset ); + H2( " --aq-mode AQ method [%d]\n" " - 0: Disabled\n" " - 1: Variance AQ (complexity mask)\n" " - 2: Auto-variance AQ (experimental)\n", defaults->rc.i_aq_mode ); - H0( " --aq-strength Reduces blocking and blurring in flat and\n" - " textured areas. [%.1f]\n" - " - 0.5: weak AQ\n" - " - 1.5: strong AQ\n", defaults->rc.f_aq_strength ); - H0( "\n" ); - H0( " -p, --pass <1|2|3> Enable multipass ratecontrol\n" - " - 1: First pass, creates stats file\n" - " - 2: Last pass, does not overwrite stats file\n" - " - 3: Nth pass, overwrites stats file\n" ); - H0( " --stats Filename for 2 pass stats [\"%s\"]\n", defaults->rc.psz_stat_out ); - H0( " --no-mbtree Disable mb-tree ratecontrol.\n"); - H1( " --qcomp QP curve compression [%.2f]\n", defaults->rc.f_qcompress ); - H1( " --cplxblur Reduce fluctuations in QP (before curve compression) [%.1f]\n", defaults->rc.f_complexity_blur ); - H1( " --qblur Reduce fluctuations in QP (after curve compression) [%.1f]\n", defaults->rc.f_qblur ); - H0( " --zones //... Tweak the bitrate of some regions of the video\n" ); - H1( " Each zone is of the form\n" + H1( " --aq-strength Reduces blocking and blurring in flat and\n" + " textured areas. [%.1f]\n", defaults->rc.f_aq_strength ); + H1( "\n" ); + H2( " -p, --pass <1|2|3> Enable multipass ratecontrol\n" ); + else H0( " -p, --pass <1|2> Enable multipass ratecontrol\n" ); + H0( " - 1: First pass, creates stats file\n" + " - 2: Last pass, does not overwrite stats file\n" ); + H2( " - 3: Nth pass, overwrites stats file\n" ); + H1( " --stats Filename for 2 pass stats [\"%s\"]\n", defaults->rc.psz_stat_out ); + H2( " --no-mbtree Disable mb-tree ratecontrol.\n"); + H2( " --qcomp QP curve compression [%.2f]\n", defaults->rc.f_qcompress ); + H2( " --cplxblur Reduce fluctuations in QP (before curve compression) [%.1f]\n", defaults->rc.f_complexity_blur ); + H2( " --qblur Reduce fluctuations in QP (after curve compression) [%.1f]\n", defaults->rc.f_qblur ); + H2( " --zones //... Tweak the bitrate of regions of the video\n" ); + H2( " Each zone is of the form\n" " ,,