Commit 7ca60994 authored by Michael Niedermayer's avatar Michael Niedermayer

max frames command line options

Originally committed as revision 3722 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 42dd22c4
...@@ -96,6 +96,7 @@ static int frame_topBand = 0; ...@@ -96,6 +96,7 @@ static int frame_topBand = 0;
static int frame_bottomBand = 0; static int frame_bottomBand = 0;
static int frame_leftBand = 0; static int frame_leftBand = 0;
static int frame_rightBand = 0; static int frame_rightBand = 0;
static int max_frames[3] = {INT_MAX, INT_MAX, INT_MAX};
static int frame_rate = 25; static int frame_rate = 25;
static int frame_rate_base = 1; static int frame_rate_base = 1;
static int video_bit_rate = 200*1000; static int video_bit_rate = 200*1000;
...@@ -711,6 +712,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -711,6 +712,7 @@ static void do_video_out(AVFormatContext *s,
}else }else
ost->sync_opts= lrintf(ost->sync_ipts * enc->frame_rate / enc->frame_rate_base); ost->sync_opts= lrintf(ost->sync_ipts * enc->frame_rate / enc->frame_rate_base);
nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number);
if (nb_frames <= 0) if (nb_frames <= 0)
return; return;
...@@ -1838,6 +1840,10 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1838,6 +1840,10 @@ static int av_encode(AVFormatContext **output_files,
if(!input_sync) file_index = ist->file_index; if(!input_sync) file_index = ist->file_index;
} }
} }
if(ost->frame_number >= max_frames[ost->st->codec.codec_type]){
file_index= -1;
break;
}
} }
/* if none, if is finished */ /* if none, if is finished */
if (file_index < 0) { if (file_index < 0) {
...@@ -3827,6 +3833,9 @@ const OptionDef options[] = { ...@@ -3827,6 +3833,9 @@ const OptionDef options[] = {
/* video options */ /* video options */
{ "b", HAS_ARG | OPT_VIDEO, {(void*)opt_video_bitrate}, "set video bitrate (in kbit/s)", "bitrate" }, { "b", HAS_ARG | OPT_VIDEO, {(void*)opt_video_bitrate}, "set video bitrate (in kbit/s)", "bitrate" },
{ "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[CODEC_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
{ "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[CODEC_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
{ "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[CODEC_TYPE_DATA]}, "set the number of data frames to record", "number" },
{ "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" }, { "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
{ "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" }, { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
......
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