From patchwork Mon Apr 4 11:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35182 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c05:b0:7a:e998:b410 with SMTP id bw5csp1913914pzb; Mon, 4 Apr 2022 04:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzed5VZHPh3wzKtEpq5zxCyoVr/T934CXBG8FH77i1tkizOZk9Av0N2GpmEhuzrN+f7lPoH X-Received: by 2002:a05:6402:524c:b0:419:4d8c:e959 with SMTP id t12-20020a056402524c00b004194d8ce959mr32742068edd.398.1649072232334; Mon, 04 Apr 2022 04:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649072232; cv=none; d=google.com; s=arc-20160816; b=0oJDOWdivKwKr59rxBPvraSFp7FLIE+vkRintmUjmnwidbJ1Fat9QIoEWY6iqPOfMy JPtc2ObkMs87XwWc41sDk7UFotoE8u7mCTo+W6KKgBePtSTNqemFeyXvd60l59kO2JfB hBCxBGoojOp92GnOjO+KCos/mUSAKNyrWXc466OmbuWBr/1/nzROlxsNhsC95ERs3IDl hlXE2ij1FCs6Yn3/z5Q1Z8QvQoHPWZyaH3VXi4gq8Q8VXAyFLKdBP2ZHbAEL3vstdPYB QjpHTWL39jDkalL+Vnc/AjCyCpcNiALiJ008qu3olOl9MyNPORRT0Vvqh3b0CJrd8uR9 4AzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=7nDMlctgFjE+jNqbNIk8+Te7q5CK4svbw3y+NBelh5w=; b=vheZrINp2ezr2TFZ1bNQpvFBWGdVRVRCbaBM0VVUOUgts9DJw1pMx4twZwn0lcn/xN ib595dpRtqC9xQX+OO6kGgnslOoVPwA31DMvZKpdtyOTLl28L35lh6ze66Z7T32iAjGm iYxf6Ll3rx/LJ9LS96HtsHAHnvtl/hIBgbe5v/Y3mT4ycAOgdfJlChTDg53eR6OstKH7 WJbia0U26n05BxonHo90B21RJTI/AHJYGJKWpr0qQkhR9nqwb8a17jk7Fgy9MVjGIpbg pBUMcXKd1I6A/AiiPal5Jek2IvWZRat9CObQVHTaRK97IXZNvfKkXEtwOEIAw1VACRFW n4aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s14-20020a170906284e00b006e7ede451d8si2191648ejc.957.2022.04.04.04.37.11; Mon, 04 Apr 2022 04:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 41A8868B339; Mon, 4 Apr 2022 14:32:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DDAC168A8A0 for ; Mon, 4 Apr 2022 14:32:27 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 773BF2400F5 for ; Mon, 4 Apr 2022 13:32:27 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Nx5xUgTmlalr for ; Mon, 4 Apr 2022 13:32:27 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id BC14C240690 for ; Mon, 4 Apr 2022 13:32:15 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 031383A0CEB; Mon, 4 Apr 2022 13:32:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Apr 2022 13:30:14 +0200 Message-Id: <20220404113037.13070-27-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220404113037.13070-1-anton@khirnov.net> References: <20220404113037.13070-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 26/49] fftools/ffmpeg_mux: stop using AVStream.nb_frames in do_video_stats() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gosmjahA9zsP Its use for muxing is not documented, in practice it is incremented per each packet successfully passed to the muxer's write_packet(). Since there is a lot of indirection between ffmpeg submitting a packet to the muxer and it actually being written (e.g. the interleaving queue), using nb_frames to count packets sent to the muxer is incorrect. Use OutputStream.packets_written instead. --- fftools/ffmpeg_mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 059beabaf3..49703ed727 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -72,7 +72,7 @@ static void do_video_stats(OutputStream *ost, int frame_size) } enc = ost->enc_ctx; - frame_number = ost->st->nb_frames; + frame_number = ost->packets_written - 1; if (vstats_version <= 1) { fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, ost->quality / (float)FF_QP2LAMBDA);