From patchwork Mon Feb 27 08:50:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Rapp X-Patchwork-Id: 2693 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp900771vsf; Mon, 27 Feb 2017 00:50:44 -0800 (PST) X-Received: by 10.223.170.146 with SMTP id h18mr12527624wrc.113.1488185443921; Mon, 27 Feb 2017 00:50:43 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g10si20569553wrc.189.2017.02.27.00.50.43; Mon, 27 Feb 2017 00:50:43 -0800 (PST) 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 A52886882EE; Mon, 27 Feb 2017 10:50:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from p1002.netstorage.at (p1002.netstorage.at [89.207.146.186]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1665B680531 for ; Mon, 27 Feb 2017 10:50:24 +0200 (EET) Received: from mailix (noaport.de [46.237.252.213]) by p1002.netstorage.at (Postfix) with ESMTPA id EBE7481B96 for ; Mon, 27 Feb 2017 09:50:32 +0100 (CET) Received: from [192.168.0.118] (HSI-KBW-46-237-252-214.hsi.kabel-badenwuerttemberg.de [46.237.252.214]) by mailix with ESMTPSA (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128) ; Mon, 27 Feb 2017 09:50:32 +0100 To: FFmpeg development discussions and patches References: <1486384400-5736-1-git-send-email-t.rapp@noa-archive.com> <2ef5c3f0-88bf-378f-698d-50a562616cc5@jkqxz.net> <52aaa233-18ad-4153-4426-31f6f3c5f47a@noa-archive.com> <20170226150913.GZ5776@nb4> From: Tobias Rapp Organization: NOA GmbH Message-ID: <0cc7464a-53cf-84f7-26b9-9ecd38b03d00@noa-archive.com> Date: Mon, 27 Feb 2017 09:50:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20170226150913.GZ5776@nb4> X-PPP-Message-ID: <20170227085033.20183.88836@p1002.netstorage.at> X-PPP-Vhost: noa-archive.com Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] ffmpeg_opt: pass output framerate as a hint to the encoder 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 26.02.2017 16:09, Michael Niedermayer wrote: > On Mon, Feb 20, 2017 at 04:05:00PM +0100, Tobias Rapp wrote: >> On 20.02.2017 15:09, Mark Thompson wrote: >>> On 06/02/17 12:33, Tobias Rapp wrote: >>>> Sets framerate field in output codec context if explicitly specified on >>>> the command-line. >>>> >>>> Signed-off-by: Tobias Rapp >>>> --- >>>> ffmpeg_opt.c | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>> >>>> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c >>>> index 6a47d32..3b532da 100644 >>>> --- a/ffmpeg_opt.c >>>> +++ b/ffmpeg_opt.c >>>> @@ -1535,6 +1535,8 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in >>>> av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); >>>> exit_program(1); >>>> } >>>> + if (frame_rate && ost->frame_rate.num && ost->frame_rate.den) >>>> + video_enc->framerate = ost->frame_rate; >>>> if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH) >>>> av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n"); >>>> >>>> >>> >>> Is there a reason not to always set this, rather than only when it is specified explicitly on the command line as you have? >>> >>> (Like , though that is after the current merge point and I don't know if it interacts with anything else.) >> >> I just tried to be extra cautious. Merging Libav commit >> d10102d23c9467d4eb84f58e0cd12be284b982f6 would provide a more >> general solution and might be preferred. > > that one would change fate results, are the changed results better or > worse ? I rebased unto current master and run fate with the attached change to ffmpeg.c applied but couldn't find any changed reference files. Which fate tests had some changes and which platform did you check? Regards, Tobias diff --git a/ffmpeg.c b/ffmpeg.c index 06570c0..333a806 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3202,6 +3202,8 @@ static int init_output_stream_encode(OutputStream *ost) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); + enc_ctx->framerate = ost->frame_rate; + ost->st->avg_frame_rate = ost->frame_rate; if (!dec_ctx ||