From patchwork Thu Oct 26 15:58:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 5702 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp975624jah; Thu, 26 Oct 2017 08:59:13 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QVOaCITRVobXnV78xBImYQoUR7uSSeO+0QH/LWcJHL80Fms+F3xtQrUv1WCPkCeZ+nA+EE X-Received: by 10.223.189.13 with SMTP id j13mr6020270wrh.94.1509033553239; Thu, 26 Oct 2017 08:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509033553; cv=none; d=google.com; s=arc-20160816; b=pliv1axUVYgWdXTO1DzDwIogkOj2fQylj2uo/GFBQKcR6uPPw+iyvQQNM7vZ5yy6Fa K3hGuacwhfJ+S7YlvoXjtQa0sox9xATzJZ5Vi1g7viwAjm/lbBYMx6DnkJv2ftBQTAJP A2zOJyh3t4FVVz/ImNHzwLH0icy7MbWnHKWD/rT26tGrjBIdOEiYr8ThCzT2jKZn81jj Aj3DUcxmuaiGA0Wgy16QvKus4+h8S4cqYtzbPwqEld5BpMaOS9ok0zCeSWjKmzJFiAwP N6kOU+eT1F57Zaltbqm08BjLKqMhVj/zjLP3LY9GAx7tcyDbW4MN4VSbrLnHl/8UxJMC emPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=G41stshcmnX/g7T1ii/JdjfYrrRR42jezzFJDseV9XE=; b=yehfeBlEOn/3DO9SAIM80w+rSDAjg0cGwIkufri5rYTwBtL5WJWE95RSIi78yA+7J0 tfCM7qAtJ+XeULs1apPvRrqLbnI0FqtLq69w8kxus74dMefmk7EsDNpug4TwHFF5j36J 0wApv3sznkbvy6Yh9pfWKbROQrSwd4NcgTIadZ7nH3/E5K8gPgQf4GUH9XYHtmy53Sgo Ifj/KW0U8dVTe1IERMM1Ljhm75HM96+1C/HFzihXlm6bq4fbmKjxJgLM9ShoEHyr94PD /H525O/Xnmg0aSaQc5WNNM8qprvvVd2/BMzQMVjjPooO0DRJBOQyc3q+I1gLo5cOxJ+5 bgzw== 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 b57si4094506wra.351.2017.10.26.08.59.12; Thu, 26 Oct 2017 08:59:13 -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 ECDD868A609; Thu, 26 Oct 2017 18:58:56 +0300 (EEST) 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 7AB7968A5F0 for ; Thu, 26 Oct 2017 18:58:48 +0300 (EEST) Received: (qmail 23949 invoked by uid 210); 26 Oct 2017 15:58:56 -0000 X-Qmail-Scanner-Diagnostics: from wl-r3-231.rz.tu-ilmenau.de (petronios@theweblords.de@wl-r3-231.rz.tu-ilmenau.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(141.24.16.231):. Processed in 0.045155 secs); 26 Oct 2017 15:58:56 -0000 Received: from wl-r3-231.rz.tu-ilmenau.de (HELO montepegro.fem.tu-ilmenau.de) (petronios@theweblords.de@141.24.16.231) by james.theweblords.de with ESMTPA; 26 Oct 2017 15:58:56 -0000 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Oct 2017 17:58:34 +0200 Message-Id: <20171026155840.16816-2-pegro@friiks.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026155840.16816-1-pegro@friiks.de> References: <20171026155840.16816-1-pegro@friiks.de> Subject: [FFmpeg-devel] [PATCH 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Anton Schubert Signed-off-by: Anton Schubert --- libavformat/dashenc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 240ff41380..a4b37403d6 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -953,6 +953,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; @@ -1007,7 +1008,9 @@ 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 * AV_TIME_BASE / av_rescale_q(os->max_pts - os->start_pts, + st->time_base, + AV_TIME_BASE_Q); if (bitrate >= 0) { os->bit_rate = bitrate; snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),