[FFmpeg-devel] [PATCH] examples: set GOP size to 10 seconds

Steven Liu lq at chinaffmpeg.org
Tue Oct 29 11:34:27 EET 2019



> 在 2019年10月29日,17:25,Alfred E. Heggestad <alfred.heggestad at gmail.com> 写道:
> 
> using a gop_size of 10 in the example code is very misleading.
> in practice this means around 2 keyframes per second.
> 
> a normal video encoder should not send keyframes so frequent,
> a better interval is 10 seconds.

10 seconds is too long. i think 10 frames maybe ok for a sample.
but usually set to 2s one GOP here, for publish stream to rtmp server.
This is just a sample, so i think 10 second is too long.
> 
> Signed-off-by: Alfred E. Heggestad <alfred.heggestad at gmail.com>
> ---
> doc/examples/encode_video.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
> index d9ab409908..8c5ee9818e 100644
> --- a/doc/examples/encode_video.c
> +++ b/doc/examples/encode_video.c
> @@ -110,13 +110,13 @@ int main(int argc, char **argv)
>     c->time_base = (AVRational){1, 25};
>     c->framerate = (AVRational){25, 1};
> 
> -    /* emit one intra frame every ten frames
> +    /* emit one intra frame every ten seconds
>      * 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->gop_size = 10 * 25;
>     c->max_b_frames = 1;
>     c->pix_fmt = AV_PIX_FMT_YUV420P;
> 
> -- 
> 2.20.1 (Apple Git-117)
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

Thanks
Steven







More information about the ffmpeg-devel mailing list