/***************************************************************************** * x264: top-level x264cli functions ***************************************************************************** * Copyright (C) 2003-2022 x264 project * * Authors: Loren Merritt * Laurent Aimar * Steven Walters * Fiona Glaser * Kieran Kunhya * Henrik Gramner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #ifdef _WIN32 /* The following two defines must be located before the inclusion of any system header files. */ #define WINVER 0x0500 #define _WIN32_WINNT 0x0500 #include #include /* _setmode() */ #include /* _O_BINARY */ #endif #include #include #include "x264cli.h" #include "input/input.h" #include "output/output.h" #include "filters/filters.h" #define QP_MAX_SPEC (51+6*2) #define QP_MAX (QP_MAX_SPEC+18) #define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "x264", __VA_ARGS__ ) #if HAVE_LAVF #undef DECLARE_ALIGNED #include #include #include #endif #if HAVE_SWSCALE #undef DECLARE_ALIGNED #include #endif #if HAVE_FFMS #include #endif #if HAVE_GPAC #include #endif #if HAVE_LSMASH #include #endif #ifdef _WIN32 #define CONSOLE_TITLE_SIZE 200 static wchar_t org_console_title[CONSOLE_TITLE_SIZE] = L""; void x264_cli_set_console_title( const char *title ) { wchar_t title_utf16[CONSOLE_TITLE_SIZE]; if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, title, -1, title_utf16, CONSOLE_TITLE_SIZE ) ) SetConsoleTitleW( title_utf16 ); } /* Retrieve command line arguments as UTF-8. */ static int get_argv_utf8( int *argc_ptr, char ***argv_ptr ) { int ret = 0; wchar_t **argv_utf16 = CommandLineToArgvW( GetCommandLineW(), argc_ptr ); if( argv_utf16 ) { int argc = *argc_ptr; int offset = (argc+1) * sizeof(char*); int size = offset; for( int i = 0; i < argc; i++ ) size += WideCharToMultiByte( CP_UTF8, 0, argv_utf16[i], -1, NULL, 0, NULL, NULL ); char **argv = *argv_ptr = malloc( size ); if( argv ) { for( int i = 0; i < argc; i++ ) { argv[i] = (char*)argv + offset; offset += WideCharToMultiByte( CP_UTF8, 0, argv_utf16[i], -1, argv[i], size-offset, NULL, NULL ); } argv[argc] = NULL; ret = 1; } LocalFree( argv_utf16 ); } return ret; } #endif /* Ctrl-C handler */ static volatile int b_ctrl_c = 0; static void sigint_handler( int a ) { b_ctrl_c = 1; } typedef struct { int b_progress; int i_seek; hnd_t hin; hnd_t hout; FILE *qpfile; FILE *tcfile_out; double timebase_convert_multiplier; int i_pulldown; } cli_opt_t; /* file i/o operation structs */ cli_input_t cli_input; static cli_output_t cli_output; /* video filter operation struct */ static cli_vid_filter_t filter; const char * const x264_avcintra_class_names[] = { "50", "100", "200", "300", "480", 0 }; const char * const x264_cqm_names[] = { "flat", "jvt", 0 }; const char * const x264_log_level_names[] = { "none", "error", "warning", "info", "debug", 0 }; const char * const x264_partition_names[] = { "p8x8", "p4x4", "b8x8", "i8x8", "i4x4", "none", "all", 0 }; const char * const x264_pulldown_names[] = { "none", "22", "32", "64", "double", "triple", "euro", 0 }; const char * const x264_range_names[] = { "auto", "tv", "pc", 0 }; const char * const x264_output_csp_names[] = { #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I400 "i400", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 "i420", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 "i422", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I444 "i444", "rgb", #endif 0 }; const char * const x264_valid_profile_names[] = { #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT <= X264_CSP_I420 #if HAVE_BITDEPTH8 #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 "baseline", "main", #endif "high", #endif #if HAVE_BITDEPTH10 "high10", #endif #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 "high422", #endif "high444", 0 }; const char * const x264_demuxer_names[] = { "auto", "raw", "y4m", #if HAVE_AVS "avs", #endif #if HAVE_LAVF "lavf", #endif #if HAVE_FFMS "ffms", #endif 0 }; const char * const x264_muxer_names[] = { "auto", "raw", "mkv", "flv", #if HAVE_GPAC || HAVE_LSMASH "mp4", #endif 0 }; static const char * const chroma_format_names[] = { [0] = "all", [X264_CSP_I400] = "i400", [X264_CSP_I420] = "i420", [X264_CSP_I422] = "i422", [X264_CSP_I444] = "i444" }; typedef struct { int mod; uint8_t pattern[24]; float fps_factor; } cli_pulldown_t; enum pulldown_type_e { X264_PULLDOWN_22 = 1, X264_PULLDOWN_32, X264_PULLDOWN_64, X264_PULLDOWN_DOUBLE, X264_PULLDOWN_TRIPLE, X264_PULLDOWN_EURO }; #define TB PIC_STRUCT_TOP_BOTTOM #define BT PIC_STRUCT_BOTTOM_TOP #define TBT PIC_STRUCT_TOP_BOTTOM_TOP #define BTB PIC_STRUCT_BOTTOM_TOP_BOTTOM static const cli_pulldown_t pulldown_values[] = { [X264_PULLDOWN_22] = {1, {TB}, 1.0}, [X264_PULLDOWN_32] = {4, {TBT, BT, BTB, TB}, 1.25}, [X264_PULLDOWN_64] = {2, {PIC_STRUCT_DOUBLE, PIC_STRUCT_TRIPLE}, 1.0}, [X264_PULLDOWN_DOUBLE] = {1, {PIC_STRUCT_DOUBLE}, 2.0}, [X264_PULLDOWN_TRIPLE] = {1, {PIC_STRUCT_TRIPLE}, 3.0}, [X264_PULLDOWN_EURO] = {24, {TBT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BTB, TB, TB, TB, TB, TB, TB, TB, TB, TB, TB, TB}, 25.0/24.0} }; #undef TB #undef BT #undef TBT #undef BTB // indexed by pic_struct enum static const float pulldown_frame_duration[10] = { 0.0, 1, 0.5, 0.5, 1, 1, 1.5, 1.5, 2, 3 }; 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 ); /* logging and printing for within the cli system */ static int cli_log_level = X264_LOG_INFO; void x264_cli_log( const char *name, int i_level, const char *fmt, ... ) { if( i_level > cli_log_level ) return; char *s_level; switch( i_level ) { case X264_LOG_ERROR: s_level = "error"; break; case X264_LOG_WARNING: s_level = "warning"; break; case X264_LOG_INFO: s_level = "info"; break; case X264_LOG_DEBUG: s_level = "debug"; break; default: s_level = "unknown"; break; } fprintf( stderr, "%s [%s]: ", name, s_level ); va_list arg; va_start( arg, fmt ); x264_vfprintf( stderr, fmt, arg ); va_end( arg ); } void x264_cli_printf( int i_level, const char *fmt, ... ) { if( i_level > cli_log_level ) return; va_list arg; va_start( arg, fmt ); x264_vfprintf( stderr, fmt, arg ); va_end( arg ); } static void print_version_info( void ) { #ifdef X264_POINTVER printf( "x264 "X264_POINTVER"\n" ); #else printf( "x264 0.%d.X\n", X264_BUILD ); #endif #if HAVE_SWSCALE printf( "(libswscale %d.%d.%d)\n", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO ); #endif #if HAVE_LAVF printf( "(libavformat %d.%d.%d)\n", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO ); #endif #if HAVE_FFMS printf( "(ffmpegsource %d.%d.%d.%d)\n", FFMS_VERSION >> 24, (FFMS_VERSION & 0xff0000) >> 16, (FFMS_VERSION & 0xff00) >> 8, FFMS_VERSION & 0xff ); #endif #if HAVE_GPAC printf( "(gpac " GPAC_VERSION ")\n" ); #endif #if HAVE_LSMASH printf( "(lsmash %d.%d.%d)\n", LSMASH_VERSION_MAJOR, LSMASH_VERSION_MINOR, LSMASH_VERSION_MICRO ); #endif printf( "built on " __DATE__ ", " ); #ifdef __INTEL_COMPILER printf( "intel: %.2f (%d)\n", __INTEL_COMPILER / 100.f, __INTEL_COMPILER_BUILD_DATE ); #elif defined(__clang__) printf( "clang: " __clang_version__ "\n" ); #elif defined(__GNUC__) printf( "gcc: " __VERSION__ "\n" ); #elif defined(_MSC_FULL_VER) printf( "msvc: %.2f (%u)\n", _MSC_VER / 100.f, _MSC_FULL_VER ); #else printf( "using an unknown compiler\n" ); #endif printf( "x264 configuration: --chroma-format=%s\n", chroma_format_names[X264_CHROMA_FORMAT] ); printf( "libx264 configuration: --chroma-format=%s\n", chroma_format_names[x264_chroma_format] ); printf( "x264 license: " ); #if HAVE_GPL printf( "GPL version 2 or later\n" ); #else printf( "Non-GPL commercial\n" ); #endif #if HAVE_SWSCALE const char *license = swscale_license(); printf( "libswscale%s%s license: %s\n", HAVE_LAVF ? "/libavformat" : "", HAVE_FFMS ? "/ffmpegsource" : "" , license ); if( !strcmp( license, "nonfree and unredistributable" ) || (!HAVE_GPL && (!strcmp( license, "GPL version 2 or later" ) || !strcmp( license, "GPL version 3 or later" )))) printf( "WARNING: This binary is unredistributable!\n" ); #endif } REALIGN_STACK int main( int argc, char **argv ) { if( argc == 4 && !strcmp( argv[1], "--autocomplete" ) ) return x264_cli_autocomplete( argv[2], argv[3] ); x264_param_t param; cli_opt_t opt = {0}; int ret = 0; FAIL_IF_ERROR( x264_threading_init(), "unable to initialize threading\n" ); #ifdef _WIN32 FAIL_IF_ERROR( !get_argv_utf8( &argc, &argv ), "unable to convert command line to UTF-8\n" ); GetConsoleTitleW( org_console_title, CONSOLE_TITLE_SIZE ); _setmode( _fileno( stdin ), _O_BINARY ); _setmode( _fileno( stdout ), _O_BINARY ); _setmode( _fileno( stderr ), _O_BINARY ); #endif x264_param_default( ¶m ); /* Parse command line */ if( parse( argc, argv, ¶m, &opt ) < 0 ) ret = -1; #ifdef _WIN32 /* Restore title; it can be changed by input modules */ SetConsoleTitleW( org_console_title ); #endif /* Control-C handler */ signal( SIGINT, sigint_handler ); if( !ret ) ret = encode( ¶m, &opt ); /* clean up handles */ if( filter.free ) filter.free( opt.hin ); else if( opt.hin ) cli_input.close_file( opt.hin ); if( opt.hout ) cli_output.close_file( opt.hout, 0, 0 ); if( opt.tcfile_out ) fclose( opt.tcfile_out ); if( opt.qpfile ) fclose( opt.qpfile ); x264_param_cleanup( ¶m ); #ifdef _WIN32 SetConsoleTitleW( org_console_title ); free( argv ); #endif return ret; } static char const *strtable_lookup( const char * const table[], int idx ) { int i = 0; while( table[i] ) i++; return ( idx >= 0 && idx < i && *table[idx] ) ? table[idx] : "???"; } static char *stringify_names( char *buf, const char * const names[] ) { int i = 0; char *p = buf; for( p[0] = 0; names[i]; i++ ) if( *names[i] ) { if( p != buf ) p += sprintf( p, ", " ); p += sprintf( p, "%s", names[i] ); } return buf; } #define INDENT " " #define INDENT_LEN 32 // strlen( INDENT ) #define SEPARATOR ", " #define SEPARATOR_LEN 2 // strlen( SEPARATOR ) static void print_csp_name_internal( const char *name, size_t *line_len, int last ) { if( name ) { size_t name_len = strlen( name ); if( *line_len + name_len > (80 - SEPARATOR_LEN) ) { printf( "\n" INDENT ); *line_len = INDENT_LEN; } printf( "%s", name ); *line_len += name_len; if( !last ) { printf( SEPARATOR ); *line_len += SEPARATOR_LEN; } } } static void print_csp_names( int longhelp ) { if( longhelp < 2 ) return; printf( " - valid csps for `raw' demuxer:\n" ); printf( INDENT ); size_t line_len = INDENT_LEN; for( int i = X264_CSP_NONE+1; i < X264_CSP_CLI_MAX; i++ ) print_csp_name_internal( x264_cli_csps[i].name, &line_len, i == X264_CSP_CLI_MAX-1 ); #if HAVE_LAVF printf( "\n" ); printf( " - valid csps for `lavf' demuxer:\n" ); printf( INDENT ); line_len = INDENT_LEN; for( enum AVPixelFormat i = AV_PIX_FMT_NONE+1; i < AV_PIX_FMT_NB; i++ ) print_csp_name_internal( av_get_pix_fmt_name( i ), &line_len, i == AV_PIX_FMT_NB-1 ); #endif printf( "\n" ); } static void help( x264_param_t *defaults, int longhelp ) { char buf[200]; #define H0 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\n" "\n" "Infile can be raw (in which case resolution is required),\n" " or YUV4MPEG (*.y4m),\n" " or Avisynth if compiled with support (%s).\n" " or libav* formats if compiled with lavf support (%s) or ffms support (%s).\n" "Outfile type is selected by filename:\n" " .264 -> Raw bytestream\n" " .mkv -> Matroska\n" " .flv -> Flash Video\n" " .mp4 -> MP4 if compiled with GPAC or L-SMASH support (%s)\n" "Output bit depth: %s\n" "\n" "Options:\n" "\n" " -h, --help List basic options\n" " --longhelp List more options\n" " --fullhelp List all options\n" "\n", X264_BUILD, X264_VERSION, #if HAVE_AVS "yes", #else "no", #endif #if HAVE_LAVF "yes", #else "no", #endif #if HAVE_FFMS "yes", #else "no", #endif #if HAVE_GPAC "gpac", #elif HAVE_LSMASH "lsmash", #else "no", #endif #if HAVE_BITDEPTH8 && HAVE_BITDEPTH10 "8/10" #elif HAVE_BITDEPTH8 "8" #elif HAVE_BITDEPTH10 "10" #else "none" #endif ); H0( "Example usage:\n" ); H0( "\n" ); H0( " Constant quality mode:\n" ); H0( " x264 --crf 24 -o \n" ); H0( "\n" ); H0( " Two-pass with a bitrate of 1000kbps:\n" ); H0( " x264 --pass 1 --bitrate 1000 -o \n" ); H0( " x264 --pass 2 --bitrate 1000 -o \n" ); H0( "\n" ); H0( " Lossless:\n" ); H0( " x264 --qp 0 -o \n" ); H0( "\n" ); H0( " Maximum PSNR at the cost of speed and visual quality:\n" ); H0( " x264 --preset placebo --tune psnr -o \n" ); H0( "\n" ); H0( " Constant bitrate at 1000kbps with a 2 second-buffer:\n"); H0( " x264 --vbv-bufsize 2000 --bitrate 1000 -o \n" ); H0( "\n" ); H0( "Presets:\n" ); H0( "\n" ); H0( " --profile Force the limits of an H.264 profile\n" " Overrides all settings.\n" ); H2( #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT <= X264_CSP_I420 #if HAVE_BITDEPTH8 #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 " - baseline:\n" " --no-8x8dct --bframes 0 --no-cabac\n" " --cqm flat --weightp 0\n" " No interlaced.\n" " No lossless.\n" " - main:\n" " --no-8x8dct --cqm flat\n" " No lossless.\n" #endif " - high:\n" " No lossless.\n" #endif #if HAVE_BITDEPTH10 " - high10:\n" " No lossless.\n" " Support for bit depth 8-10.\n" #endif #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 " - high422:\n" " No lossless.\n" " Support for bit depth 8-10.\n" " Support for 4:2:0/4:2:2 chroma subsampling.\n" #endif " - high444:\n" " Support for bit depth 8-10.\n" " Support for 4:2:0/4:2:2/4:4:4 chroma subsampling.\n" ); else H0( " - %s\n", stringify_names( buf, x264_valid_profile_names ) ); H0( " --preset Use a preset to select encoding settings [medium]\n" " Overridden by user settings.\n" ); H2( " - ultrafast:\n" " --no-8x8dct --aq-mode 0 --b-adapt 0\n" " --bframes 0 --no-cabac --no-deblock\n" " --no-mbtree --me dia --no-mixed-refs\n" " --partitions none --rc-lookahead 0 --ref 1\n" " --scenecut 0 --subme 0 --trellis 0\n" " --no-weightb --weightp 0\n" " - superfast:\n" " --no-mbtree --me dia --no-mixed-refs\n" " --partitions i8x8,i4x4 --rc-lookahead 0\n" " --ref 1 --subme 1 --trellis 0 --weightp 1\n" " - veryfast:\n" " --no-mixed-refs --rc-lookahead 10\n" " --ref 1 --subme 2 --trellis 0 --weightp 1\n" " - faster:\n" " --no-mixed-refs --rc-lookahead 20\n" " --ref 2 --subme 4 --weightp 1\n" " - fast:\n" " --rc-lookahead 30 --ref 2 --subme 6\n" " --weightp 1\n" " - medium:\n" " Default settings apply.\n" " - slow:\n" " --direct auto --rc-lookahead 50 --ref 5\n" " --subme 8 --trellis 2\n" " - slower:\n" " --b-adapt 2 --direct auto --me umh\n" " --partitions all --rc-lookahead 60\n" " --ref 8 --subme 9 --trellis 2\n" " - veryslow:\n" " --b-adapt 2 --bframes 8 --direct auto\n" " --me umh --merange 24 --partitions all\n" " --ref 16 --subme 10 --trellis 2\n" " --rc-lookahead 60\n" " - placebo:\n" " --bframes 16 --b-adapt 2 --direct auto\n" " --slow-firstpass --no-fast-pskip\n" " --me tesa --merange 24 --partitions all\n" " --rc-lookahead 60 --ref 16 --subme 11\n" " --trellis 2\n" ); else H0( " - ultrafast,superfast,veryfast,faster,fast\n" " - medium,slow,slower,veryslow,placebo\n" ); H0( " --tune Tune the settings for a particular type of source\n" " or situation\n" " Overridden by user settings.\n" " Multiple tunings are separated by commas.\n" " Only one psy tuning can be used at a time.\n" ); H2( " - film (psy tuning):\n" " --deblock -1:-1 --psy-rd :0.15\n" " - animation (psy tuning):\n" " --bframes {+2} --deblock 1:1\n" " --psy-rd 0.4: --aq-strength 0.6\n" " --ref {Double if >1 else 1}\n" " - grain (psy tuning):\n" " --aq-strength 0.5 --no-dct-decimate\n" " --deadzone-inter 6 --deadzone-intra 6\n" " --deblock -2:-2 --ipratio 1.1\n" " --pbratio 1.1 --psy-rd :0.25\n" " --qcomp 0.8\n" " - stillimage (psy tuning):\n" " --aq-strength 1.2 --deblock -3:-3\n" " --psy-rd 2.0:0.7\n" " - psnr (psy tuning):\n" " --aq-mode 0 --no-psy\n" " - ssim (psy tuning):\n" " --aq-mode 2 --no-psy\n" " - fastdecode:\n" " --no-cabac --no-deblock --no-weightb\n" " --weightp 0\n" " - zerolatency:\n" " --bframes 0 --force-cfr --no-mbtree\n" " --sync-lookahead 0 --sliced-threads\n" " --rc-lookahead 0\n" ); else H0( " - psy tunings: film,animation,grain,\n" " stillimage,psnr,ssim\n" " - other tunings: fastdecode,zerolatency\n" ); H2( " --slow-firstpass Don't force these faster settings with --pass 1:\n" " --no-8x8dct --me dia --partitions none\n" " --ref 1 --subme {2 if >2 else unchanged}\n" " --trellis 0 --fast-pskip\n" ); else H1( " --slow-firstpass Don't force 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 ); H2( " -i, --min-keyint Minimum GOP size [auto]\n" ); H2( " --no-scenecut Disable adaptive I-frame decision\n" ); H2( " --scenecut How aggressively to insert extra I-frames [%d]\n", defaults->i_scenecut_threshold ); H2( " --intra-refresh Use Periodic Intra Refresh instead of IDR frames\n" ); 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 ); 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 [%s]\n" " - none: Disabled\n" " - strict: Strictly hierarchical pyramid\n" " - normal: Non-strict (not Blu-ray compatible)\n", strtable_lookup( x264_b_pyramid_names, defaults->i_bframe_pyramid ) ); H1( " --open-gop Use recovery points to close GOPs\n" " Only available with b-frames\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" ); H1( " -f, --deblock Loop filter parameters [%d:%d]\n", defaults->i_deblocking_filter_alphac0, defaults->i_deblocking_filter_beta ); H2( " --slices Number of slices per frame; forces rectangular\n" " slices and is overridden by other slicing options\n" ); else H1( " --slices Number of slices per frame\n" ); H2( " --slices-max Absolute maximum slices per frame; overrides\n" " slice-max-size/slice-max-mbs when necessary\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 (max)\n"); H2( " --slice-min-mbs Limit the size of each slice in macroblocks (min)\n"); H0( " --tff Enable interlaced mode (top field first)\n" ); H0( " --bff Enable interlaced mode (bottom field first)\n" ); H2( " --constrained-intra Enable constrained intra prediction.\n" ); H0( " --pulldown Use soft pulldown to change frame rate\n" " - %s (requires cfr input)\n", stringify_names( buf, x264_pulldown_names ) ); H2( " --fake-interlaced Flag stream as interlaced but encode progressive.\n" " Makes it possible to encode 25p and 30p Blu-Ray\n" " streams. Ignored in interlaced mode.\n" ); H2( " --frame-packing For stereoscopic videos define frame arrangement\n" " - 0: checkerboard - pixels are alternatively from L and R\n" " - 1: column alternation - L and R are interlaced by column\n" " - 2: row alternation - L and R are interlaced by row\n" " - 3: side by side - L is on the left, R on the right\n" " - 4: top bottom - L is on top, R on bottom\n" " - 5: frame alternation - one view per frame\n" " - 6: mono - 2D frame without any frame packing\n" " - 7: tile format - L is on top-left, R split across\n" ); H0( "\n" ); H0( "Ratecontrol:\n" ); H0( "\n" ); H1( " -q, --qp Force constant QP (0-%d, 0=lossless)\n", QP_MAX ); H0( " -B, --bitrate Set bitrate (kbit/s)\n" ); H0( " --crf Quality-based VBR (%d-51) [%.1f]\n", 51 - QP_MAX_SPEC, defaults->rc.f_rf_constant ); 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 ); H2( " --vbv-init Initial VBV buffer occupancy [%.1f]\n", defaults->rc.f_vbv_buffer_init ); H2( " --crf-max With CRF+VBV, limit RF to this value\n" " May cause VBV underflows!\n" ); H2( " --qpmin Set min QP [%d]\n", defaults->rc.i_qp_min ); H2( " --qpmax Set max QP [%d]\n", X264_MIN( defaults->rc.i_qp_max, QP_MAX ) ); H2( " --qpstep Set max QP step [%d]\n", defaults->rc.i_qp_step ); H2( " --ratetol Tolerance of ABR ratecontrol and VBV [%.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\n" " - 3: Auto-variance AQ with bias to dark scenes\n", defaults->rc.i_aq_mode ); H1( " --aq-strength Reduces blocking and blurring in flat and\n" " textured areas. [%.1f]\n", defaults->rc.f_aq_strength ); H1( "\n" ); H0( " -p, --pass Enable multipass ratecontrol\n" " - 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" " ,,