Commit 457eaa93 authored by Loren Merritt's avatar Loren Merritt

option '--frames' limits number of frames to encode.

patch by Tuukka Toivonen <tuukkat at ee.oulu.fi>


git-svn-id: svn://svn.videolan.org/x264/trunk@70 df754926-b1dd-0310-bc7b-ec298dee348c
parent dfbbcec8
......@@ -54,6 +54,7 @@ void x264_param_default( x264_param_t *param )
param->vui.i_sar_height= 0;
param->i_fps_num = 25;
param->i_fps_den = 1;
param->i_maxframes = 0;
/* Encoder parameters */
param->i_frame_reference = 1;
......
......@@ -138,6 +138,7 @@ static void Help( void )
" --subme <integer> Subpixel motion estimation quality\n"
"\n"
" -s, --sar width:height Specify Sample Aspect Ratio\n"
" --frames <integer> Maximum number of frames to encode\n"
" -o, --output Specify output file\n"
"\n"
" --no-asm Disable any CPU optims\n"
......@@ -184,6 +185,7 @@ static int Parse( int argc, char **argv,
#define OPT_SCENECUT 270
#define OPT_QBLUR 271
#define OPT_CPLXBLUR 272
#define OPT_FRAMES 273
static struct option long_options[] =
{
......@@ -203,6 +205,7 @@ static int Parse( int argc, char **argv,
{ "ref", required_argument, NULL, 'r' },
{ "no-asm", no_argument, NULL, 'C' },
{ "sar", required_argument, NULL, 's' },
{ "frames", required_argument, NULL, OPT_FRAMES },
{ "output", required_argument, NULL, 'o' },
{ "analyse", required_argument, NULL, 'A' },
{ "subme", required_argument, NULL, OPT_SUBME },
......@@ -293,6 +296,9 @@ static int Parse( int argc, char **argv,
case 'C':
param->cpu = 0;
break;
case OPT_FRAMES:
param->i_maxframes = atoi( optarg );
break;
case'o':
if( ( *p_fout = fopen( optarg, "wb" ) ) == NULL )
{
......@@ -620,6 +626,9 @@ static int Encode( x264_param_t *param, FILE *fyuv, FILE *fout )
int i;
if (param->i_maxframes!=0 && i_frame>=param->i_maxframes)
break;
/* read a frame */
if( fread( pic.img.plane[0], 1, param->i_width * param->i_height, fyuv ) <= 0 ||
fread( pic.img.plane[1], 1, param->i_width * param->i_height / 4, fyuv ) <= 0 ||
......
......@@ -104,6 +104,7 @@ typedef struct
int i_fps_num;
int i_fps_den;
int i_maxframes; /* Maximum number of frames to read from input file and encode, 0=unlimited */
/* Bitstream parameters */
int i_frame_reference; /* Maximum number of reference frames */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment