From 54f0b54585262252220b49c0f672de0b6f22e959 Mon Sep 17 00:00:00 2001 From: rigaya Date: Sun, 16 Feb 2025 09:18:02 +0900 Subject: [PATCH] =?UTF-8?q?=E9=96=8B=E5=A7=8Bdts/pts=E3=81=8C0=E3=81=A7?= =?UTF-8?q?=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88=E3=81=AB=E3=80=81=E8=AA=A4?= =?UTF-8?q?=E3=81=A3=E3=81=9Fdts=E8=A8=88=E7=AE=97=E3=81=8C=E3=81=AA?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NVEncCore/rgy_output_avcodec.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NVEncCore/rgy_output_avcodec.cpp b/NVEncCore/rgy_output_avcodec.cpp index 5843f664..726667d4 100644 --- a/NVEncCore/rgy_output_avcodec.cpp +++ b/NVEncCore/rgy_output_avcodec.cpp @@ -2900,9 +2900,9 @@ RGY_ERR RGYOutputAvcodec::WriteNextFrameInternal(RGYBitstream *bitstream, int64_ //dts生成を初期化 //何フレーム前からにすればよいかは、b-pyramid次第で異なるので、可能な限りエンコーダの情報を使用する + const auto srcTimebase = (ENCODER_QSV) ? HW_NATIVE_TIMEBASE : m_Mux.video.bitstreamTimebase; #if ENCODER_QSV if (bitstream->dts() != MFX_TIMESTAMP_UNKNOWN) { - const auto srcTimebase = (ENCODER_QSV) ? HW_NATIVE_TIMEBASE : m_Mux.video.bitstreamTimebase; m_VideoOutputInfo.videoDelay = (m_VideoOutputInfo.codec == RGY_CODEC_AV1 && AV1_TIMESTAMP_OVERRIDE) ? 0 : -1 * (int)av_rescale_q(bitstream->dts() - bitstream->pts(), srcTimebase, av_inv_q(m_Mux.video.outputFps)); } #endif @@ -2911,8 +2911,9 @@ RGY_ERR RGYOutputAvcodec::WriteNextFrameInternal(RGYBitstream *bitstream, int64_ const AVRational fpsTimebase = (m_Mux.video.afs) ? av_inv_q(av_mul_q(m_Mux.video.outputFps, av_make_q(4, 5))) : av_inv_q(m_Mux.video.outputFps); const AVRational streamTimebase = m_Mux.video.streamOut->time_base; + const auto firstPacketPts = av_rescale_q(bitstream->pts(), srcTimebase, streamTimebase); for (int i = m_Mux.video.fpsBaseNextDts; i < 0; i++) { - m_Mux.video.timestampList.add(bitstream->pts() + av_rescale_q(i, fpsTimebase, streamTimebase)); + m_Mux.video.timestampList.add(firstPacketPts + av_rescale_q(i, fpsTimebase, streamTimebase)); } }