We have to use video_in_stream->time_base as codeccontext->time_base is not used in decoding

This commit is contained in:
Isaac Connor
2025-01-09 14:03:19 -05:00
parent 57bf222346
commit 4e2c8cd32b

View File

@@ -1194,15 +1194,15 @@ int VideoStore::writeVideoFramePacket(const std::shared_ptr<ZMPacket> zm_packet)
Debug(2, "No video_first_pts, set to (%" PRId64 ")", video_first_pts);
frame->pts = 0;
} else {
frame->pts = av_rescale_q(zm_packet->in_frame->pts - video_first_pts, zm_packet->in_frame->time_base, video_out_ctx->time_base);
frame->pts = av_rescale_q(zm_packet->in_frame->pts - video_first_pts, video_in_stream->time_base, video_out_ctx->time_base);
Debug(2,
"Setting pts for frame(%d) to (%" PRId64 ") from (zm_packet->in_frame(%" PRIi64 " - first %" PRId64 " ) @ %d/%d=>%d/%d",
frame_count,
frame->pts,
zm_packet->in_frame->pts,
video_first_pts,
zm_packet->in_frame->time_base.num,
zm_packet->in_frame->time_base.den,
video_in_stream->time_base.num,
video_in_stream->time_base.den,
video_out_ctx->time_base.num,
video_out_ctx->time_base.den);
}