From e33ed4c9fc447b7e4bc057e85f9ee83b07b714e1 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Wed, 29 Dec 2004 12:08:50 +0000 Subject: [PATCH] new option: --fps git-svn-id: svn://svn.videolan.org/x264/trunk@75 df754926-b1dd-0310-bc7b-ec298dee348c --- x264.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/x264.c b/x264.c index 7ab863e5..0dc8f987 100644 --- a/x264.c +++ b/x264.c @@ -138,6 +138,7 @@ static void Help( void ) " --subme Subpixel motion estimation quality\n" "\n" " -s, --sar width:height Specify Sample Aspect Ratio\n" + " --fps Specify framerate\n" " --frames Maximum number of frames to encode\n" " -o, --output Specify output file\n" "\n" @@ -186,6 +187,7 @@ static int Parse( int argc, char **argv, #define OPT_QBLUR 271 #define OPT_CPLXBLUR 272 #define OPT_FRAMES 273 +#define OPT_FPS 274 static struct option long_options[] = { @@ -205,6 +207,7 @@ static int Parse( int argc, char **argv, { "ref", required_argument, NULL, 'r' }, { "no-asm", no_argument, NULL, 'C' }, { "sar", required_argument, NULL, 's' }, + { "fps", required_argument, NULL, OPT_FPS }, { "frames", required_argument, NULL, OPT_FRAMES }, { "output", required_argument, NULL, 'o' }, { "analyse", required_argument, NULL, 'A' }, @@ -316,6 +319,22 @@ static int Parse( int argc, char **argv, } break; } + case OPT_FPS: + { + float fps; + if( sscanf( optarg, "%d/%d", ¶m->i_fps_num, ¶m->i_fps_den ) == 2 ) + ; + else if( sscanf( optarg, "%f", &fps ) ) + { + param->i_fps_num = (int)(fps * 1000 + .5); + param->i_fps_den = 1000; + } + else + { + fprintf( stderr, "bad fps `%s'\n", optarg ); + return -1; + } + } case 'A': param->analyse.inter = 0; if( strstr( optarg, "none" ) ) param->analyse.inter = 0x000000; @@ -677,7 +696,7 @@ static int Encode( x264_param_t *param, FILE *fyuv, FILE *fout ) double fps = (double)i_frame * (double)1000000 / (double)( i_end - i_start ); - fprintf( stderr, "encoded %d frames %ffps %lld kb/s\n", i_frame, fps, i_file * 8 * 25 / i_frame / 1000 ); + fprintf( stderr, "encoded %d frames, %.2f fps, %.2f kb/s\n", i_frame, fps, (double) i_file * 8 * param->i_fps_num / ( param->i_fps_den * i_frame * 1000 ) ); } return 0; -- 2.40.0