[FFmpeg-devel] [PATCH] examples: set GOP size to 10 seconds
Michael Niedermayer
michael at niedermayer.cc
Wed Oct 30 13:44:06 EET 2019
On Tue, Oct 29, 2019 at 10:25:03AM +0100, Alfred E. Heggestad wrote:
> 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.
>
> 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;
several codecs have a limit of 132 dependant non key blocks
so 250 is a risky default, it would only strictly be valid with B frames
for some codecs
I know 10sec is commonly used but i think it should not be the recommanded
default in an example for the reason above. Especially not without
clear documentation of the spec violation this could cause
Thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191030/3ec7d70d/attachment.sig>
More information about the ffmpeg-devel
mailing list