📄 x264.c
字号:
" smpte170m, smpte240m, GBR, YCgCo\n", strtable_lookup( x264_colmatrix_names, defaults->vui.i_colmatrix ) ); H1( " --chromaloc <integer> Specify chroma sample location (0 to 5) [%d]\n", defaults->vui.i_chroma_loc ); H0( "\n" ); H0( "Input/Output:\n" ); H0( "\n" ); H0( " -o, --output Specify output file\n" ); H0( " --sar width:height Specify Sample Aspect Ratio\n" ); H0( " --fps <float|rational> Specify framerate\n" ); H0( " --seek <integer> First frame to encode\n" ); H0( " --frames <integer> Maximum number of frames to encode\n" ); H0( " --level <string> Specify level (as defined by Annex A)\n" ); H0( "\n" ); H0( " -v, --verbose Print stats for each frame\n" ); H0( " --progress Show a progress indicator while encoding\n" ); H0( " --quiet Quiet Mode\n" ); H0( " --no-psnr Disable PSNR computation\n" ); H0( " --no-ssim Disable SSIM computation\n" ); H0( " --threads <integer> Parallel encoding\n" ); H0( " --thread-input Run Avisynth in its own thread\n" ); H1( " --non-deterministic Slightly improve quality of SMP, at the cost of repeatability\n" ); H1( " --no-asm Disable all CPU optimizations\n" ); H1( " --visualize Show MB types overlayed on the encoded video\n" ); H1( " --sps-id <integer> Set SPS and PPS id numbers [%d]\n", defaults->i_sps_id ); H1( " --aud Use access unit delimiters\n" ); H0( "\n" );}/***************************************************************************** * Parse: *****************************************************************************/static int Parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt ){ char *psz_filename = NULL; x264_param_t defaults = *param; char *psz; int b_avis = 0; int b_y4m = 0; int b_thread_input = 0; memset( opt, 0, sizeof(cli_opt_t) ); /* Default input file driver */ p_open_infile = open_file_yuv; p_get_frame_total = get_frame_total_yuv; p_read_frame = read_frame_yuv; p_close_infile = close_file_yuv; /* Default output file driver */ p_open_outfile = open_file_bsf; p_set_outfile_param = set_param_bsf; p_write_nalu = write_nalu_bsf; p_set_eop = set_eop_bsf; p_close_outfile = close_file_bsf; /* Parse command line options */ for( ;; ) { int b_error = 0; int long_options_index = -1;#define OPT_FRAMES 256#define OPT_SEEK 257#define OPT_QPFILE 258#define OPT_THREAD_INPUT 259#define OPT_QUIET 260#define OPT_PROGRESS 261#define OPT_VISUALIZE 262#define OPT_LONGHELP 263 static struct option long_options[] = { { "help", no_argument, NULL, 'h' }, { "longhelp",no_argument, NULL, OPT_LONGHELP }, { "version", no_argument, NULL, 'V' }, { "bitrate", required_argument, NULL, 'B' }, { "bframes", required_argument, NULL, 'b' }, { "no-b-adapt", no_argument, NULL, 0 }, { "b-bias", required_argument, NULL, 0 }, { "b-pyramid", no_argument, NULL, 0 }, { "min-keyint",required_argument,NULL,'i' }, { "keyint", required_argument, NULL, 'I' }, { "scenecut",required_argument, NULL, 0 }, { "pre-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, 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 }, { "ref", required_argument, NULL, 'r' }, { "no-asm", no_argument, NULL, 0 }, { "sar", required_argument, NULL, 0 }, { "fps", required_argument, NULL, 0 }, { "frames", required_argument, NULL, OPT_FRAMES }, { "seek", required_argument, NULL, OPT_SEEK }, { "output", required_argument, NULL, 'o' }, { "analyse", required_argument, NULL, 0 }, { "partitions", required_argument, NULL, 'A' }, { "direct", required_argument, NULL, 0 }, { "direct-8x8", required_argument, NULL, 0 }, { "weightb", no_argument, NULL, 'w' }, { "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' }, { "b-rdo", no_argument, NULL, 0 }, { "mixed-refs", no_argument, NULL, 0 }, { "no-chroma-me", no_argument, NULL, 0 }, { "bime", no_argument, NULL, 0 }, { "8x8dct", no_argument, NULL, '8' }, { "trellis", required_argument, NULL, 't' }, { "no-fast-pskip", no_argument, NULL, 0 }, { "no-dct-decimate", no_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 }, { "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 }, { "rceq", required_argument, NULL, 0 }, { "qcomp", required_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 }, { "thread-input", no_argument, NULL, OPT_THREAD_INPUT }, { "non-deterministic", no_argument, NULL, 0 }, { "no-psnr", no_argument, NULL, 0 }, { "no-ssim", no_argument, NULL, 0 }, { "quiet", no_argument, NULL, OPT_QUIET }, { "verbose", no_argument, NULL, 'v' }, { "progress",no_argument, NULL, OPT_PROGRESS }, { "visualize",no_argument, NULL, OPT_VISUALIZE }, { "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 }, {0, 0, 0, 0} }; int c = getopt_long( argc, argv, "8A:B:b:f:hI:i:m:o:p:q:r:t:Vvw", long_options, &long_options_index); if( c == -1 ) { break; } switch( c ) { case 'h': Help( &defaults, 0 ); exit(0); case OPT_LONGHELP: Help( &defaults, 1 ); exit(0); case 'V':#ifdef X264_POINTVER printf( "x264 "X264_POINTVER"\n" );#else printf( "x264 0.%d.X\n", X264_BUILD );#endif exit(0); case OPT_FRAMES: param->i_frame_total = atoi( optarg ); break; case OPT_SEEK: opt->i_seek = atoi( optarg ); break; case 'o': if( !strncasecmp(optarg + strlen(optarg) - 4, ".mp4", 4) ) {#ifdef MP4_OUTPUT p_open_outfile = open_file_mp4; p_write_nalu = write_nalu_mp4; p_set_outfile_param = set_param_mp4; p_set_eop = set_eop_mp4; p_close_outfile = close_file_mp4;#else fprintf( stderr, "x264 [error]: not compiled with MP4 output support\n" ); return -1;#endif } else if( !strncasecmp(optarg + strlen(optarg) - 4, ".mkv", 4) ) { p_open_outfile = open_file_mkv; p_write_nalu = write_nalu_mkv; p_set_outfile_param = set_param_mkv; p_set_eop = set_eop_mkv; p_close_outfile = close_file_mkv; } if( !strcmp(optarg, "-") ) opt->hout = stdout; else if( p_open_outfile( optarg, &opt->hout ) ) { fprintf( stderr, "x264 [error]: can't open output file `%s'\n", optarg ); return -1; } break; case OPT_QPFILE: opt->qpfile = fopen( optarg, "r" ); if( !opt->qpfile ) { fprintf( stderr, "x264 [error]: can't open `%s'\n", optarg ); return -1; } param->i_scenecut_threshold = -1; param->b_bframe_adaptive = 0; break; case OPT_THREAD_INPUT: b_thread_input = 1; break; case OPT_QUIET: param->i_log_level = X264_LOG_NONE; break; case 'v': param->i_log_level = X264_LOG_DEBUG; break; case OPT_PROGRESS: opt->b_progress = 1; break; case OPT_VISUALIZE:#ifdef VISUALIZE param->b_visualize = 1; b_exit_on_ctrl_c = 1;#else fprintf( stderr, "x264 [warning]: not compiled with visualization support\n" );#endif break; default: { int i; if( long_options_index < 0 ) { for( i = 0; long_options[i].name; i++ ) if( long_options[i].val == c ) { long_options_index = i; break; } if( long_options_index < 0 ) { /* getopt_long already printed an error message */ return -1; } } b_error |= x264_param_parse( param, long_options[long_options_index].name, optarg ); } } if( b_error )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -