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

Alfred E. Heggestad alfred.heggestad at gmail.com
Tue Oct 29 11:25:03 EET 2019


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;
      c->max_b_frames = 1;
      c->pix_fmt = AV_PIX_FMT_YUV420P;

-- 
2.20.1 (Apple Git-117)



More information about the ffmpeg-devel mailing list