From patchwork Mon Apr 4 11:30:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 35191 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c05:b0:7a:e998:b410 with SMTP id bw5csp1915251pzb; Mon, 4 Apr 2022 04:39:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN/LbuQayibYYtvXckTjoTH17ZOIw7U1oSdga/TSqnGsuk29gPxga1czE32ak+d4GEGnTn X-Received: by 2002:a17:907:2d07:b0:6e0:13e2:841b with SMTP id gs7-20020a1709072d0700b006e013e2841bmr10289981ejc.502.1649072383746; Mon, 04 Apr 2022 04:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649072383; cv=none; d=google.com; s=arc-20160816; b=p5CYmtLLzXWtX4nhHBlvj1JN/lIpZ91CsI8/1qOhwZ9JJUYBY5eci4G2clyJHWcEPP n91wv1noj3PiUHnz7ouJelR6EJ7NnimSBlNohDWlqhKRSoGBRUDH099i3CKijUu9lyd2 8N4ZO0RDYPHPUp9W+STnu/fSuTe9nljxYnMc2j5oEZMiR+6tJ4Ng48gMxVbiCiOvpbLI 5m7iNLs7YQAgcUk/klJiC+4Y6IH4Rkzuz/7Vqys0TyUkQaIL1lPbKkFjdI2gX5h0Uvdm 2v2JaZ+IgJ6GZ2SPt2nPRsao2XXEiIRWea6yoTYUMdUTnvvnQ6dm8uC59nWaX1fftctT rnNw== 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=R05cUVoeCt2GTrsN8QnpQyk4Ry0BMuxchvE1xm/7M5E=; b=YfwCBwd7bOPUU91Cv9gTJCkcOf4n53FkelHJBFr45L9Q1GP7O0KsfQTgfmScyakMv1 4RC3AjHdp7OEA3D0CGQ6YOCfem32AwfyNDef1BWk6zz5JGud+a97hPIvmtVI2zb0tQUy RkpbVrXHHUpEnInmLoUyhfAyrDISb6XKJTjVjfKWVZG6wlWuIuN2wAqpLG/erHly24V9 JAAk3P3xs9C/1Kxvc0nQ+DVAeIYB0cbJBMtSKUiKEVNTWO3jFqHoN5iOjVJrbOt5kwdO xXwHGMGMcpy+eJnTG8S6bV/xcX8vSVgdcoaCp24yOGOU2o6yhsvLJ8pwABIptifHQbD7 Uc6Q== 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 z8-20020a17090665c800b006e66edfcccesi1828962ejn.756.2022.04.04.04.39.43; Mon, 04 Apr 2022 04:39:43 -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 6CFF468B2CD; Mon, 4 Apr 2022 14:37:54 +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 C076468B34A for ; Mon, 4 Apr 2022 14:37:45 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 7E6B624017E for ; Mon, 4 Apr 2022 13:37:45 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id QI7NSdacaVMZ for ; Mon, 4 Apr 2022 13:37:45 +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 B2438240511 for ; Mon, 4 Apr 2022 13:37:41 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 06A6B3A0CF7; Mon, 4 Apr 2022 13:32:12 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Apr 2022 13:30:15 +0200 Message-Id: <20220404113037.13070-28-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 27/49] fftools/ffmpeg_mux: stop using av_stream_get_end_pts() 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: SwfOWy/UFNBe It retrieves libavformat's internal dts value (contrary to the function's name), which is not necessary here because we can access the packet directly. --- fftools/ffmpeg_mux.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 49703ed727..8e0e278e4f 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -56,7 +56,7 @@ struct Muxer { static int want_sdp = 1; -static void do_video_stats(OutputStream *ost, int frame_size) +static void do_video_stats(OutputStream *ost, const AVPacket *pkt) { AVCodecContext *enc; int frame_number; @@ -84,13 +84,13 @@ static void do_video_stats(OutputStream *ost, int frame_size) if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR)) fprintf(vstats_file, "PSNR= %6.2f ", psnr(ost->error[0] / (enc->width * enc->height * 255.0 * 255.0))); - fprintf(vstats_file,"f_size= %6d ", frame_size); + fprintf(vstats_file,"f_size= %6d ", pkt->size); /* compute pts value */ - ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); + ti1 = pkt->dts * av_q2d(ost->st->time_base); if (ti1 < 0.01) ti1 = 0.01; - bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; + bitrate = (pkt->size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); @@ -222,7 +222,7 @@ static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt) if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed && vstats_filename) - do_video_stats(ost, pkt->size); + do_video_stats(ost, pkt); pkt->stream_index = ost->index;