[FFmpeg-devel] [PATCH 18/21] fftools/ffmpeg_filter: stop using InputStream.pts for filter EOF ts

Anton Khirnov anton at khirnov.net
Thu Apr 27 17:25:58 EEST 2023


Use InputStream.last_frame_pts/duration instead, which is more accurate.
---
 fftools/ffmpeg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a69aceec9f..3ffc37729c 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1374,7 +1374,9 @@ static int send_filter_eof(InputStream *ist)
     int i, ret;
 
     for (i = 0; i < ist->nb_filters; i++) {
-        ret = ifilter_send_eof(ist->filters[i], ist->pts, AV_TIME_BASE_Q);
+        int64_t end_pts = ist->last_frame_pts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE :
+                          ist->last_frame_pts + ist->last_frame_duration_est;
+        ret = ifilter_send_eof(ist->filters[i], end_pts, ist->last_frame_tb);
         if (ret < 0)
             return ret;
     }
-- 
2.39.2



More information about the ffmpeg-devel mailing list