summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-11-30 16:03:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-11-30 16:03:29 +0000
commit7ca60994f7560672343ae927e91bc50e2a068e8c (patch)
tree0ecc1528328095a522a26f37fdda9503c49c1e07 /ffmpeg.c
parent42dd22c4a5c8463488d442eeb234b822bcc39625 (diff)
max frames command line options
Originally committed as revision 3722 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 045ee54a29..d1f358aaf4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -96,6 +96,7 @@ static int frame_topBand = 0;
static int frame_bottomBand = 0;
static int frame_leftBand = 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_base = 1;
static int video_bit_rate = 200*1000;
@@ -711,6 +712,7 @@ static void do_video_out(AVFormatContext *s,
}else
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)
return;
@@ -1838,6 +1840,10 @@ static int av_encode(AVFormatContext **output_files,
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 (file_index < 0) {
@@ -3827,6 +3833,9 @@ const OptionDef options[] = {
/* video options */
{ "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" },
{ "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" },