Commit 17aea3648b for ffmpeg
commit 17aea3648b4d2005fb84cd5083fbfd1ea67c6338
Author: James Almer <jamrial@gmail.com>
Date: Fri Dec 4 11:42:21 2026 -0300
avcodec/libx264: mark B frames as disposable
Same as it's done for x265 and SVT-AV1
Signed-off-by: James Almer <jamrial@gmail.com>
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 6681773a0e..fe9b9ce113 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -800,6 +800,9 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
return AVERROR_EXTERNAL;
}
+ if (pic_out.i_type == X264_TYPE_B)
+ pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
+
pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
if (ret) {
int error_count = 0;