From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9582A43DE1 for ; Sun, 11 Sep 2022 20:44:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CFA2368BB14; Sun, 11 Sep 2022 23:44:46 +0300 (EEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 97B5168B9ED for ; Sun, 11 Sep 2022 23:44:40 +0300 (EEST) Received: by mail-pl1-f171.google.com with SMTP id d12so6746455plr.6 for ; Sun, 11 Sep 2022 13:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date; bh=Qj2gvofmzPx7rAiKScy0ihpKuGdglwlQSinnerQcHdg=; b=mvziTKnwcbhoPKj6sqSkEdJkbX/PgnUTSYONvfZvdAMB88j9O0kir7ibsM34kNIp3w 7xXLYNI72YQ9ovdJUakMcDM3L/SjSyUH6lrjjljUJ3DQWDM14HNKRVLhAKHDd5DsxRzM yP0CY2VN3LvI9dDVZPMHhjIyNxE4a7T/qiFbk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date; bh=Qj2gvofmzPx7rAiKScy0ihpKuGdglwlQSinnerQcHdg=; b=EbEM+5OucBSd5BL4uGE6Zo9V8ZqLXKFU+uICVFPbxWz20rHY4rpwO0y37Lykc/6LMs WWV/v7mpi68NND4TNqukAkK8m/+1gsSIqSZnCT09OEZN2BTUcG/1WIgwLFkyFkUoq/Jm BZhxrOOTHlI+pAOSoPMUsFFGLSFW0vm28yf3Q+JSsrv+Rpa0cyUDwGfGQwLbWAMjZ4kd 5XYm9J/qac30CRCaUyRarul2GMXVz6KxTWP4s796ndzgNGqF1PamKShJ4K0nX7X9bAIT +/ZqD3u/C4kciD29ZjXDf6+RbcI5e5LBg7XjmfCiC8v2/Hw3K6khRNryO4BlE9d6A4as /dGw== X-Gm-Message-State: ACgBeo1FIsiBTBT/+Ccbcye+vC5Sn81gukXbwwDPALiC3OP7Mew+tuMZ mprpGN82tJ248nfQZj0oSE4WPaRQSLkQvQ== X-Google-Smtp-Source: AA6agR6DBTCJVMiIcy4Ect1Cux69jKGJd6JvF9nGB3bPT+iUHEypwUjpz3psNW8PLmMYgR4r+vgLkA== X-Received: by 2002:a17:903:22cc:b0:178:18a1:d16c with SMTP id y12-20020a17090322cc00b0017818a1d16cmr9545734plg.155.1662929078168; Sun, 11 Sep 2022 13:44:38 -0700 (PDT) Received: from smtpclient.apple ([2607:fb10:7011:1::3d]) by smtp.gmail.com with ESMTPSA id x4-20020a170902ea8400b0016f975be2e7sm4307165plb.139.2022.09.11.13.44.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Sep 2022 13:44:37 -0700 (PDT) From: Li-Heng Chen Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Message-Id: Date: Sun, 11 Sep 2022 13:44:36 -0700 To: ffmpeg-devel@ffmpeg.org X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg: Fix EOF pts for libavfilter in send_filter_eof() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: When input is video bitstream (e.g. *.264) with framerate set by -r, ist->pts could be a nonsense value. In libavfilter/vf_fps, the pts value of EOF from above is compared to pts derived from inlink. The wrong EOF pts may trigger a bug, where ffmpeg keeps writting the last video frame to the output. This bug can be easily reproduced by the ffmpeg cmd below (h264 bitstreams in fate-suite can reproduce this issue): ffmpeg -r num_in/den_in -i bitstream -vf fps=num_out/den_out -f rawvideo out.yuv Example: ffmpeg -r 24/1 -i fate-suite/h264/bbc2.sample.h264 -vf fps=24/1 -f rawvideo out.yuv Signed-off-by: Li-Heng Chen --- fftools/ffmpeg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0e1477299d..e9a986c95b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2383,6 +2383,9 @@ static int send_filter_eof(InputStream *ist) int64_t pts = av_rescale_q_rnd(ist->pts, AV_TIME_BASE_Q, ist->st->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); + if(ist->framerate.num) + pts = ist->cfr_next_pts; + for (i = 0; i < ist->nb_filters; i++) { ret = ifilter_send_eof(ist->filters[i], pts); if (ret < 0) -- 2.32.1 (Apple Git-133) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".