[FFmpeg-devel] [PATCH] avfilter/src_movie: last_pts should be added with duration.
jiangjie
jiangjie618 at gmail.com
Mon Oct 14 05:53:30 EEST 2024
if video has only one frame, frame->pts - st->last_pts will always be 0.
---
libavfilter/src_movie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index d2aa572d12..8bbe913574 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -544,7 +544,7 @@ static int decode_packet(AVFilterContext *ctx, int i)
frame->pts += av_rescale_q_rnd(movie->ts_offset, AV_TIME_BASE_Q, outlink->time_base, AV_ROUND_UP);
if (st->discontinuity_threshold) {
if (st->last_pts != AV_NOPTS_VALUE) {
- int64_t diff = frame->pts - st->last_pts;
+ int64_t diff = frame->pts - (st->last_pts + pkt->duration);
if (diff < 0 || diff > st->discontinuity_threshold) {
av_log(ctx, AV_LOG_VERBOSE, "Discontinuity in stream:%d diff:%"PRId64"\n", i, diff);
movie->ts_offset += av_rescale_q_rnd(-diff, outlink->time_base, AV_TIME_BASE_Q, AV_ROUND_UP);
--
2.43.0
More information about the ffmpeg-devel
mailing list