[FFmpeg-devel] [PATCH] Fixing computation of number of B frames for GXF muxer

Thierry Foucu tfoucu
Thu Feb 12 00:54:36 CET 2009


After chatting with Baptiste, i was told that the variable name b_per_gop is
for the number  of B between I and Pnot the number of B frames per GOP.

So, new patch to still fix the computation of b_per_gop

On Wed, Feb 11, 2009 at 3:35 PM, Thierry Foucu <tfoucu at gmail.com> wrote:

> For GXF muxer, the code to compute the number of B frames in a GOP is
> wrong.
> For example:
> if you have I frames: 75, P frames: 449, B frames: 374
> Here is the GOP was 12 and 1 B frame between I and P
> the current code will compute 0 frames per GOP.
>
> With the patch, it will compute 5
>
-------------- next part --------------
Index: libavformat/gxfenc.c
===================================================================
--- libavformat/gxfenc.c	(revision 17163)
+++ libavformat/gxfenc.c	(working copy)
@@ -175,8 +175,11 @@
         ctx->p_per_gop = ctx->pframes / ctx->iframes;
         if (ctx->pframes % ctx->iframes)
             ctx->p_per_gop++;
-        if (ctx->pframes)
+        if (ctx->pframes) {
             ctx->b_per_gop = ctx->bframes / ctx->pframes;
+            if (ctx->bframes % ctx->pframes)
+                ctx->b_per_gop++;
+        }
         if (ctx->p_per_gop > 9)
             ctx->p_per_gop = 9; /* ensure value won't take more than one char */
         if (ctx->b_per_gop > 9)



More information about the ffmpeg-devel mailing list