From patchwork Sun Oct 29 15:10:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 5745 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1667586jah; Sun, 29 Oct 2017 08:10:50 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SHpfUkuS+OqCkgloanhw7hKkTaR+GjOe/03W40RCbuMUySWA7ompShVXJF4RdKLj1J6UDX X-Received: by 10.223.170.154 with SMTP id h26mr5164639wrc.87.1509289850632; Sun, 29 Oct 2017 08:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509289850; cv=none; d=google.com; s=arc-20160816; b=vIl4zwLIkmPNLJc2TnIuqq8Ydey/unW3IG8z0WMHQjuV/1Lfkm8mXjMxeL7tsv/bun cLcdLSmygx4KxStlBXFoRm8JqD12+7MFhBTouzTY4n+TJaWNoCGRWKTEQHfPO9+8pxZV 8v6fwjbu5VQJSv0lUevZjZULaImrMRaeB1qeEIaEeJsXfvuTq/Q9DM6zfNJja8gib903 i9oEJg4RQMLbbOEyYvy07sWEMS46cy2j0QwSIbcbjFrSMHWhL0p3dEQYhjyjbZzo6MPF 3G/pDbqUe55jEAHPhtUupxcHewKxHw2Ql/7q4pljQVqqHqT6/ogzZAVkPOva+o2fWZv0 OEPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:arc-authentication-results; bh=TUcTvskp8oox1FFr5GXvMYHZuSq1/55KCPXMr3GFBgw=; b=TUkF86gSXlS0VdnYfVX+UqYxIgPaiDVfa9eAn5w2UgaME3pKiAgKSUImH5EzZ6PD8N MTNLS3Nq13QuY6exngPUC6XwPZ7zRseyDkMxpY00Kz6I4SU4js8zia8PXx8qaRvvXs1R mtWgpttDgzMOCaZRIZNdNwDctaspzi2tfUq9G8lxRkUjgDJAvdMJLJfkmB1JL4TmJiqn zdaX+LF2kgrxJ59312A0qqT7TOIqUS2tjxdK7OwEm7Kk47atDvrrPTeXPD42jwIFLE5Q sF0Ljyg9RfaAIMWVl5nF1pN3UzvxLd0bx2ELqVayAN9fJ1wBbqzzbomaXv/+eZk+6Qx0 yT6w== 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 j188si1418833wmg.35.2017.10.29.08.10.50; Sun, 29 Oct 2017 08:10:50 -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 BBBB668097C; Sun, 29 Oct 2017 17:10:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from james.theweblords.de (james.theweblords.de [217.11.55.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 740C16805C1 for ; Sun, 29 Oct 2017 17:10:33 +0200 (EET) Received: (qmail 11336 invoked by uid 210); 29 Oct 2017 15:10:42 -0000 X-Qmail-Scanner-Diagnostics: from x4d07d30c.dyn.telefonica.de (petronios@theweblords.de@x4d07d30c.dyn.telefonica.de) by james (envelope-from , uid 201) with qmail-scanner-2.10st (mhr: 1.0. spamassassin: 3.4.1. perlscan: 2.10st. Clear:RC:1(77.7.211.12):. Processed in 0.041509 secs); 29 Oct 2017 15:10:42 -0000 Received: from x4d07d30c.dyn.telefonica.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@77.7.211.12) by james.theweblords.de with ESMTPA; 29 Oct 2017 15:10:42 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Oct 2017 16:10:34 +0100 Message-Id: <20171029151036.16579-1-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171028004612.GG6009@nb4> References: <20171028004612.GG6009@nb4> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/7] dashenc: fix bitrate estimation with correct scaling X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Anton Schubert , =?UTF-8?q?Peter=20Gro=C3=9Fe?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Anton Schubert Signed-off-by: Anton Schubert Signed-off-by: Peter Große --- v2: Fixed double rescaling. libavformat/dashenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 04b0fd99e6..e25a660fbe 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -947,6 +947,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; + AVStream *st = s->streams[i]; char filename[1024] = "", full_path[1024], temp_path[1024]; int range_length, index_length = 0; @@ -1001,7 +1002,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) if (!os->bit_rate) { // calculate average bitrate of first segment - int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / (os->max_pts - os->start_pts); + int64_t bitrate = (int64_t) range_length * 8 / ((os->max_pts - os->start_pts) * av_q2d(st->time_base)); if (bitrate >= 0) { os->bit_rate = bitrate; snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),