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 44F4B42222 for ; Tue, 1 Mar 2022 04:49:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5D8CE68B160; Tue, 1 Mar 2022 06:49:05 +0200 (EET) Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CF1968A6A3 for ; Tue, 1 Mar 2022 06:48:59 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4K74XB2kcdz9sSn for ; Tue, 1 Mar 2022 05:48:58 +0100 (CET) Message-ID: <468880f7-71ae-8708-a8e2-5a7f1015933a@gyani.pro> Date: Tue, 1 Mar 2022 10:18:40 +0530 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: Gyan Doshi In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] libavformat/concatdev.c: use the unified time base 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2022-03-01 09:46 am, Ye Chuan wrote: > In some case, the input files have different time base > even though they share the same codec and codec parameters, > > So when we replace the packet, we need use the unified time base > instead of it of each stream own, which may lead to wrong pts/dts > of the output packet. Make this optional. This 'bug' has been used to effect speed change in some inputs. Regards, Gyan > > Signed-off-by: Chuan Ye > --- > libavformat/concatdec.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c > index 0603c6e254..f7067d5059 100644 > --- a/libavformat/concatdec.c > +++ b/libavformat/concatdec.c > @@ -740,6 +740,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) > ConcatStream *cs; > AVStream *st; > FFStream *sti; > + AVRational output_tb; > > if (cat->eof) > return AVERROR_EOF; > @@ -782,13 +783,15 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) > av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), > av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); > > + /* replace the pkt base on the time base of target output stream */ > + output_tb = avf->streams[cs->out_stream_index]->time_base; > delta = av_rescale_q(cat->cur_file->start_time - cat->cur_file->file_inpoint, > AV_TIME_BASE_Q, > - cat->avf->streams[pkt->stream_index]->time_base); > + output_tb); > if (pkt->pts != AV_NOPTS_VALUE) > - pkt->pts += delta; > + pkt->pts = av_rescale_q(pkt->pts, st->time_base, output_tb) + delta; > if (pkt->dts != AV_NOPTS_VALUE) > - pkt->dts += delta; > + pkt->dts = av_rescale_q(pkt->dts, st->time_base, output_tb) + delta; > av_log(avf, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n", > av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), > av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); _______________________________________________ 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".