From b56b1eff4e2db0674ad00594f1c6aa00a520044c Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 12 Apr 2023 15:33:53 +0800 Subject: [PATCH] output pts --- simp_ffmpeg_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simp_ffmpeg_output.c b/simp_ffmpeg_output.c index 7ab5ba8..9991892 100644 --- a/simp_ffmpeg_output.c +++ b/simp_ffmpeg_output.c @@ -254,8 +254,6 @@ static int __ffmpeg_encode(simp_avio_t* io, AVCodecContext* c, AVPacket* pkt, AV int64_t pts = frame->pts; - frame->pts = frame->pts * av_q2d(c->time_base) / av_q2d(s->time_base); - int ret = avcodec_send_frame(c, frame); if (ret < 0) { scf_loge("avcodec_send_frame error, ret: %s\n", av_err2str(ret)); @@ -274,6 +272,9 @@ static int __ffmpeg_encode(simp_avio_t* io, AVCodecContext* c, AVPacket* pkt, AV pkt->stream_index = idx; + pkt->pts = pkt->pts * av_q2d(c->time_base) / av_q2d(s->time_base); + pkt->dts = pkt->dts * av_q2d(c->time_base) / av_q2d(s->time_base); + scf_logw("idx: %d, frame->pts: %ld, pkt->stream_index: %d, pkt->pts: %ld, pts: %ld, c->time_base: %d:%d, s->time_base: %d:%d\n", idx, frame->pts, pkt->stream_index, pkt->pts, pts, c->time_base.num, c->time_base.den, s->time_base.num, s->time_base.den); -- 2.25.1