From: Yasuhiro Ikeda Date: Thu, 20 Jan 2011 14:12:01 +0000 (+0900) Subject: Add --input-fmt option to lavf input X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=bb4182d8ea123666819d9547a7b5234d4da34a1b;p=x264.git Add --input-fmt option to lavf input Conforms to ffmpeg's `-f` option. Use this when lavf fails to guess the input format. --- diff --git a/input/input.h b/input/input.h index 1deff127..c8008a6a 100644 --- a/input/input.h +++ b/input/input.h @@ -34,6 +34,7 @@ typedef struct { char *index_file; + char *format; char *resolution; char *colorspace; int bit_depth; diff --git a/input/lavf.c b/input/lavf.c index fc1172c3..2f26aa9e 100644 --- a/input/lavf.c +++ b/input/lavf.c @@ -147,7 +147,12 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c param->pix_fmt = opt->colorspace ? av_get_pix_fmt( opt->colorspace ) : PIX_FMT_YUV420P; } - FAIL_IF_ERROR( av_open_input_file( &h->lavf, psz_filename, NULL, 0, param ), "could not open input file\n" ) + /* specify the input format. this is helpful when lavf fails to guess */ + AVInputFormat *format = NULL; + if( opt->format ) + FAIL_IF_ERROR( !(format = av_find_input_format( opt->format )), "unknown file format: %s\n", opt->format ); + + FAIL_IF_ERROR( av_open_input_file( &h->lavf, psz_filename, format, 0, param ), "could not open input file\n" ) if( param ) free( param ); FAIL_IF_ERROR( av_find_stream_info( h->lavf ) < 0, "could not find input stream info\n" ) diff --git a/x264.c b/x264.c index 4d5114b7..c0d7a0f1 100644 --- a/x264.c +++ b/x264.c @@ -721,6 +721,7 @@ static void help( x264_param_t *defaults, int longhelp ) " - %s\n", muxer_names[0], stringify_names( buf, muxer_names ) ); H1( " --demuxer Specify input container format [\"%s\"]\n" " - %s\n", demuxer_names[0], stringify_names( buf, demuxer_names ) ); + H1( " --input-fmt Specify input file format (requires lavf support)\n" ); H1( " --input-csp Specify input colorspace format for raw input\n" ); print_csp_names( longhelp ); H1( " --input-depth Specify input bit depth for raw input\n" ); @@ -797,6 +798,7 @@ enum OPT_PULLDOWN, OPT_LOG_LEVEL, OPT_VIDEO_FILTER, + OPT_INPUT_FMT, OPT_INPUT_RES, OPT_INPUT_CSP, OPT_INPUT_DEPTH, @@ -952,6 +954,7 @@ static struct option long_options[] = { "frame-packing", required_argument, NULL, 0 }, { "vf", required_argument, NULL, OPT_VIDEO_FILTER }, { "video-filter", required_argument, NULL, OPT_VIDEO_FILTER }, + { "input-fmt", required_argument, NULL, OPT_INPUT_FMT }, { "input-res", required_argument, NULL, OPT_INPUT_RES }, { "input-csp", required_argument, NULL, OPT_INPUT_CSP }, { "input-depth", required_argument, NULL, OPT_INPUT_DEPTH }, @@ -1314,6 +1317,9 @@ static int parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt ) case OPT_VIDEO_FILTER: vid_filters = optarg; break; + case OPT_INPUT_FMT: + input_opt.format = optarg; + break; case OPT_INPUT_RES: input_opt.resolution = optarg; break;