Skip to content

Effort free video editing!

Mark x264's unreferenced B frames as disposable

WyattBlue067997b5ddf3
diff --git a/patches/ffmpeg.patch b/patches/ffmpeg.patch
index a0b2e273..123e63e0 100644
--- a/patches/ffmpeg.patch
+++ b/patches/ffmpeg.patch
@@ -20,6 +20,19 @@ index f5e1fbb..fb4ca4c 100755
gmp
libaribb24
libastcenc
+diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
+--- a/libavcodec/libx264.c
++++ b/libavcodec/libx264.c
+@@ -724,6 +724,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;
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c