[x265] [PATCH] Support for VBV-End feature
Yaswanth Sastry
yaswanth.sastry at multicorewareinc.com
Thu Oct 3 12:24:58 UTC 2024
>From b9a23076ec4033f2ae7f03d7124b4add78f15502 Mon Sep 17 00:00:00 2001
From: Monica Nandakumar <monica at multicorewareinc.com>
Date: Thu, 3 Oct 2024 17:42:24 +0530
Subject: [PATCH] Support for VBV-End feature
---
fftools/ffmpeg_enc.c | 2 ++
libavcodec/avcodec.h | 1 +
libavcodec/libx265.c | 2 ++
3 files changed, 5 insertions(+)
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index a46af4dce1..080e44f2df 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -187,7 +187,9 @@ int enc_open(void *opaque, const AVFrame *frame)
InputStream *ist = ost->ist;
Encoder *e = ost->enc;
EncoderPriv *ep = ep_from_enc(e);
+ AVFormatContext* ic = input_files[ost->file->index]->ctx;
AVCodecContext *enc_ctx = e->enc_ctx;
+ enc_ctx->duration = (double)(ic->duration);
Decoder *dec = NULL;
const AVCodec *enc = enc_ctx->codec;
OutputFile *of = ost->file;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 77ca8dee1f..e6ca5babee 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2086,6 +2086,7 @@ typedef struct AVCodecContext {
*/
AVFrameSideData **decoded_side_data;
int nb_decoded_side_data;
+ double duration;
} AVCodecContext;
/**
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 513f473307..4d0da86930 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -693,6 +693,7 @@ static int libx265_encode_frame(AVCodecContext *avctx,
AVPacket *pkt,
}
x265pic.pts = pic->pts;
+ x265pic.poc = pic->pts;
x265pic.bitDepth =
av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ?
@@ -786,6 +787,7 @@ static int libx265_encode_frame(AVCodecContext *avctx,
AVPacket *pkt,
}
#if X265_BUILD >= 167
+
ctx->api->configure_vbv_end(ctx->encoder,&x265pic,(avctx->duration/1000000));
sd = av_frame_get_side_data(pic, AV_FRAME_DATA_DOVI_METADATA);
if (ctx->dovi.cfg.dv_profile && sd) {
const AVDOVIMetadata *metadata = (const AVDOVIMetadata
*)sd->data;
--
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/821639fd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_to_fix_vbvend_initialisation_error.diff
Type: application/octet-stream
Size: 2047 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241003/821639fd/attachment.obj>
More information about the x265-devel
mailing list