From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 20D0845F72 for ; Wed, 19 Apr 2023 21:12:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 62E4C68BE9A; Thu, 20 Apr 2023 00:12:20 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED1CF68ABC3 for ; Thu, 20 Apr 2023 00:12:13 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id AE4A62404EE for ; Wed, 19 Apr 2023 23:12:13 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id hQg3cKHApd7m for ; Wed, 19 Apr 2023 23:12:12 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (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 "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id D8BC42404EC for ; Wed, 19 Apr 2023 23:12:12 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id BD8B61601B2; Wed, 19 Apr 2023 23:12:12 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20230419195243.2974-1-anton@khirnov.net> <20230419195243.2974-4-anton@khirnov.net> Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 19 Apr 2023 23:12:12 +0200 Message-ID: <168193873275.3843.14791972888014285320@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 04/25] fftools/ffmpeg_enc: always use video frame durations when available 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting James Almer (2023-04-19 22:42:24) > On 4/19/2023 4:52 PM, Anton Khirnov wrote: > > diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c > > index e3dc858bc3..9aaec277f1 100644 > > --- a/fftools/ffmpeg_enc.c > > +++ b/fftools/ffmpeg_enc.c > > @@ -1005,24 +1005,17 @@ static void do_video_out(OutputFile *of, > > AVRational frame_rate; > > int64_t nb_frames, nb_frames_prev, i; > > double duration = 0; > > - InputStream *ist = ost->ist; > > AVFilterContext *filter = ost->filter->filter; > > > > - frame_rate = av_buffersink_get_frame_rate(filter); > > - if (frame_rate.num > 0 && frame_rate.den > 0) > > - duration = 1/(av_q2d(frame_rate) * av_q2d(enc->time_base)); > > + if (next_picture) > > + duration = lrintf(next_picture->duration * av_q2d(next_picture->time_base) / av_q2d(enc->time_base)); > > llrint(). You're passing it a double argument, and long int is 32 bits > on Windows. I'm just reusing the code as it was before, except for reducing the conditions and using the frame timebase instead of the stream one. Given how fragile this all is, I'd rather not do too many changes at once. The whole rounding step is rather questionable, since the integer result is assigned to a double. But I'd say that belongs in a separate patch. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".