ffmpeg | branch: master | Clément Bœsch <u...@pkh.me> | Wed Mar 29 14:16:33 2017 +0200| [4726bbb471566f7d2a0c883210870871a17fe2e3] | committer: Clément Bœsch
Merge commit 'd0a603a534a0ee4b255e5e72742428a7f7f42b83' * commit 'd0a603a534a0ee4b255e5e72742428a7f7f42b83': examples/encode_video: set the framerate Merged-by: Clément Bœsch <u...@pkh.me> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4726bbb471566f7d2a0c883210870871a17fe2e3 --- doc/examples/encode_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index 265b529..ba6f2bf 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -75,7 +75,9 @@ int main(int argc, char **argv) c->width = 352; c->height = 288; /* frames per second */ - c->time_base = (AVRational){1,25}; + c->time_base = (AVRational){1, 25}; + c->framerate = (AVRational){25, 1}; + /* emit one intra frame every ten frames * check frame pict_type before passing frame * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I ====================================================================== diff --cc doc/examples/encode_video.c index 265b529,b955cce..ba6f2bf --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@@ -75,23 -69,16 +75,25 @@@ int main(int argc, char **argv c->width = 352; c->height = 288; /* frames per second */ - c->time_base = (AVRational){1,25}; + c->time_base = (AVRational){1, 25}; + c->framerate = (AVRational){25, 1}; + - c->gop_size = 10; /* emit one intra frame every ten frames */ - c->max_b_frames=1; + /* emit one intra frame every ten frames + * check frame pict_type before passing frame + * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I + * then gop_size is ignored and the output of encoder + * will always be I frame irrespective to gop_size + */ + c->gop_size = 10; + c->max_b_frames = 1; c->pix_fmt = AV_PIX_FMT_YUV420P; + if (codec->id == AV_CODEC_ID_H264) + av_opt_set(c->priv_data, "preset", "slow", 0); + /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "could not open codec\n"); + fprintf(stderr, "Could not open codec\n"); exit(1); } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog