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 D27E64562F for ; Wed, 12 Apr 2023 19:55:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66E9F68AD1B; Wed, 12 Apr 2023 22:55:26 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F129680642 for ; Wed, 12 Apr 2023 22:55:19 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E6D5A2404EE for ; Wed, 12 Apr 2023 21:55:18 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IvmI0cGBeyqT for ; Wed, 12 Apr 2023 21:55:18 +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 47A782404EC for ; Wed, 12 Apr 2023 21:55:18 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 28DC21601B2; Wed, 12 Apr 2023 21:55:18 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20230402190321.GI3542@mariano> References: <20230402180535.43550-1-stefasab@gmail.com> <20230402181416.GH3542@mariano> <20230402190321.GI3542@mariano> Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 12 Apr 2023 21:55:18 +0200 Message-ID: <168132931813.3843.795237116879735910@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/avcodec.h: fix typos in AVCodecContext.pkt_timebase description 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 Stefano Sabatini (2023-04-02 21:03:21) > On date Sunday 2023-04-02 20:14:16 +0200, Stefano Sabatini wrote: > > On date Sunday 2023-04-02 20:05:35 +0200, Stefano Sabatini wrote: > > > --- > > > libavcodec/avcodec.h | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > > index 1e91b9cb53..dec5e40eac 100644 > > > --- a/libavcodec/avcodec.h > > > +++ b/libavcodec/avcodec.h > > > @@ -1781,9 +1781,9 @@ typedef struct AVCodecContext { > > > enum AVPixelFormat sw_pix_fmt; > > > > > > /** > > > - * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. > > > - * - encoding unused. > > > - * - decoding set by user. > > > + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed. > > > + * - encoding: unused. > > > + * - decoding: set by user. > > > */ > > > AVRational pkt_timebase; > > > > BTW, also I'm still confused by this field. > > > > What happens in case it is not set? The majority of decoding code treats timestamps as opaque numbers, they are simply copied from packets to their corresponding frames. You don't need to know the timebase to do that. > > In this case I assume the decoder/libavcodec will pick a suitable > > timebase which is directly set in the decoded frames? Is the field > > internally set in this case, or the information is only stored in > > the output frames? Some code does more involved timestamp manipulation, e.g. adjusting timestamps after skipping audio samples. When the timebase is not known, this manipulation is just not done. > > How libavcodec detects if the field is set or not? By num&den being >0. > > Also, is there any guarantee that the decoded frame time base should > be set based on the pkt_timebase value? > In practice this does not happen (so that I had to set the time_base > explicitly in the decoded frame in transcode.c). Is this expected or > the library should explicitly set the time_base in the decoded frames? > The latter is what I would expect. AVFrame/AVPacket.time_base were added quite recently and (to avoid surprises for the API users) the libraries do not use them yet. If and when that changes, it will probably require explicit opt-in from the caller. I've also recently started using them in ffmpeg CLI. -- 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".