[FFmpeg-devel] [PATCH] avcodec/nvenc: fix dts>pts when b frame >= 1
Agatha Hu
ahu at nvidia.com
Wed Jan 14 06:25:46 CET 2015
On 2015/1/11 0:44, Michael Niedermayer wrote:
> * PGP Signed by an unknown key
>
> On Sat, Jan 10, 2015 at 05:30:03PM +0100, Timo Rothenpieler wrote:
>>
>> Looks good to merge for me.
>
> i wanted to apply it but the patch is corrupted
> Applying: avcodec/nvenc: fix dts>pts when b frame >= 1
> fatal: corrupt patch at line 10
>
> its so badly corrupted, even unwrap-diff cant fix it
> Agatha, please disable line/word wrap for patches or attach them
> and if that doesnt help use a different MUA / SMTP server whatever is
> causing this
>
> [...]
>
>
Try using the attachment, if it still doesn't work, I'll use my gmail
account to send it.
Agatha Hu
-------------- next part --------------
>From cd62a0c47eb77f16efae25966b729c0f30852263 Mon Sep 17 00:00:00 2001
From: agathah <ahu at nvidia.com>
Date: Wed, 7 Jan 2015 17:19:32 +0800
Subject: [PATCH] fix b frame settings
---
libavcodec/nvenc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 345fb78..19a3ec8 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -657,9 +657,14 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
}
if (ctx->gobpattern >= 0) {
- ctx->encode_config.frameIntervalP = 1;
+ ctx->encode_config.frameIntervalP = ctx->gobpattern;
}
+ // when there're b frames, set dts offset
+ if (ctx->encode_config.frameIntervalP >= 2) {
+ ctx->last_dts = -2;
+ }
+
ctx->encode_config.encodeCodecConfig.h264Config.h264VUIParameters.colourDescriptionPresentFlag = 1;
ctx->encode_config.encodeCodecConfig.h264Config.h264VUIParameters.videoSignalTypePresentFlag = 1;
@@ -905,6 +910,10 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, AVFrame
pkt->pts = lock_params.outputTimeStamp;
pkt->dts = timestamp_queue_dequeue(&ctx->timestamp_list);
+ // when there're b frame(s), set dts offset
+ if (ctx->encode_config.frameIntervalP >= 2)
+ pkt->dts -= 1;
+
if (pkt->dts > pkt->pts)
pkt->dts = pkt->pts;
--
1.9.5.github.0
More information about the ffmpeg-devel
mailing list