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 062784221F for ; Tue, 1 Mar 2022 04:16:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC3C668B148; Tue, 1 Mar 2022 06:16:21 +0200 (EET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2010.outbound.protection.outlook.com [40.92.20.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AECE368B110 for ; Tue, 1 Mar 2022 06:16:15 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J6WuuCcgsYuJwp2F3j5vLA11dQ+m3b4wW2GHsVU/rSr5bbMRYmSjK0kHogP9a/Rufmn/WU6FK4MFHE5hM376wKl6zWuwzRwpzSwlSng+zHKw5bgrMoFxenFWD+SJTuBqSORWXI2ItcbiLM9bcwHr5A3HH+3UxuuCeSOokAr5tw5fmc9hjYk0AimP6jbQO30t4/xf8ul/y+yc2DFYtNjQZFLy17vpMbAMTh06zK3HeS2awbMEk1rBhkdnMbSmD1YtqEjNBxsZLDweafKNSD/sXfO1R/LSfKDiM8X3ZSdetxxYh++gl3oQHTDUNwxf/0P/0PtVPPj4h6aH4TCDkxLcfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cAO8PWMlQtLWY6vxB927BX6gnTWBpTohNEtlQms6J1Y=; b=fbc62uwp3q0pQHOiapxPS2/rwh8vKY3PiGdxriuX0pKspZtJe5e5nxcdAMQ2Y+ExNkPi0B2pXlwF9DDIzQgoyf73pa5PLrQCGOtVfIjXR89s3N7ve+3FQdg2wY/F5LB1NdJSWVEHK7xvwTghvZNi9IAQ0xgc68O8A2ZZ+YPdXi8y2c5MCI7ld2uNMOsHhfOZXkfuzWqJ/ttarQZ1iw4Trd8fRc6NdAmJ8YV+yv7VnlLZOTTqqQfD3wvEYgv5Kh4LfOP1tglCMXHPRQVTkomgZZyYksQCUUdr7+RnTG5UH/rjpt1uTVuEEfXiwMQKzqkFicRGJjXJiyNZNPh3MutKVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cAO8PWMlQtLWY6vxB927BX6gnTWBpTohNEtlQms6J1Y=; b=EySHva94J1kPng38iamPRcNeFEKUAT9vFnDuq11ZM6bTX6ljDghzENwpjoKZeDd9PM8zG2czqqJf4fFddyBgcpKme9z2Vj9CHggopy8BBAfatT122LiR5ZpOtpDbeWe9OR+Hi3IgMow+kH90NRXVJZFRootYVX22pafCKyVhOYGS2AH5Vo96Xxr27eFZRQ/hlatTXbcKt+a3lfEDvGtfIENLrSx7PW0evW/AGkxeoBFSXG5F64khqHnYlw/eSgCUK3W5NSZI/yLpTo6WiOcfoY+E4xFp/0DO5biiojMoXd+5D+/VzkCGpuVDETHrLk8+VCtWRpor87rPru8eZ9g40w== Received: from SA1PR17MB5122.namprd17.prod.outlook.com (2603:10b6:806:1b5::9) by CY4PR17MB1048.namprd17.prod.outlook.com (2603:10b6:903:a2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Tue, 1 Mar 2022 04:16:13 +0000 Received: from SA1PR17MB5122.namprd17.prod.outlook.com ([fe80::c532:34c4:902:d206]) by SA1PR17MB5122.namprd17.prod.outlook.com ([fe80::c532:34c4:902:d206%5]) with mapi id 15.20.5017.026; Tue, 1 Mar 2022 04:16:12 +0000 From: Ye Chuan To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH] libavformat/concatdev.c: use the unified time base Thread-Index: AQHYLSMW0f/JsM/CFUSc5N/cnEA1vw== Date: Tue, 1 Mar 2022 04:16:12 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [HBLmehQJX8ix6C3bQiCcyzz8Ud4NghBl] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ad9455cf-855c-4118-ab63-08d9fb3a38d4 x-ms-traffictypediagnostic: CY4PR17MB1048:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Uyrg0z3z8+cN3KG3WkPKp5wrWsu22sAd9vuUnETOAXs8tpy6rDsLhoP70UUw6o02Qy39d8rC9GhkeTBO7k+OJiYkmNt+CgOa1p2erl7QiyykFJtUxBal1HeNyb4jQDoD9WCd5WKyNNuWo6GOD53rtit5iPCyqIaoLV3YYIEZiKixGQzebTQ1ar/WXCB5hUZLGcj6cAu42wkscGwPoqT5i8FK5ZA3v+qw6fptPiBJuNlH283mSF0W5fVFM8FYDVZNFBAjGwjd3TEABVqWw2ruz3T3SCsKebbV7GvlyDOQvhqkJ00/Mi4gxm0RwY9HCh5LC3H5zT4AGzuZEk0LVSIvKlteZ8cnDD57yOqQDhK3JgYxt/y056zwIYyGt3MXzsgZDsYvqaDyqKbuK7OGMZUGOSTflRGM5cF8FWs3U40hx5SLPZM+S8OUnYq2FzafzX7MmuLXNNADIbw6H6wqvx91HiHJ+9/LrZq5wns6ihI14MzH1i5XfQrpPlO9qD0VjTOGP+fUxQDVTfq6FhngRHwvSgv/D5VTMfy4FbT0IwJT5oH8VeIGeQiFHlsSxPtkodc4b7pAFdrHmhsDDj36UuyrLg== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2/DeQRVTPHkDr/4JKmwNIchwWc8rX69DQSnaGNCPiqurF0O0CG83VAPNHOqE?= =?us-ascii?Q?AsNGOeIAyQrEpKsi+MvAdY03lcKv3eqFYp7C+Wru90rmHsH7VxxQ1BKs+ByG?= =?us-ascii?Q?B2DzxQwKAoOw1yG5FcGPloUtftwSGl04HyUqn57v7PKP0tf+ubkX6uay3zxO?= =?us-ascii?Q?Hgd2QXATHrgRX81MjotLUuZLlIi30TW03RpxFCddMQpVHjJ03X+HNJUMoiuD?= =?us-ascii?Q?lxGeo7qcFFnYcf4ayMvTXdlmT/kGyd0mIOwZ8tIJp0kuHahbhtuy8bV0+1qu?= =?us-ascii?Q?jPYjC1taPWg6fnaiYqCVe7cMJqp7jh540rvXcnxSdoXueXaRo2es4JW5/3r1?= =?us-ascii?Q?jBRLyHLtm1OpjMyC93Th6m6+bR0CNeWLKqbUomKdDRB2oeIP+jLpAdIsODtN?= =?us-ascii?Q?cOF91agInzIEh0vz5ZYWEfdaLkP3cwQf9cVyouZ7Ne31E15YAM1fGug/bXHQ?= =?us-ascii?Q?T9PtQU/Xqa1shKWUyE3nsDhbL5FsCm7dYs08urNugtkEFi//zFOqUv+hGP/F?= =?us-ascii?Q?zbJdbxtx4KZVgvIU2PEStLC5hY181mP3YZM5BZVcwgxVXXJuSaha8MD51m/N?= =?us-ascii?Q?oZaKGfASaAVvNwfr/jhX6/poPl3NKJTMKERe5ir0adDCqs1Wi0uPpyznh0vd?= =?us-ascii?Q?vrdyQStWBMkh9WZS0vk9FgKoaaHdD7nKQzzVyqVfIuBrChoU2qpW/pF8mq+Q?= =?us-ascii?Q?b3/cnBfUKZWQborGoTNAP3xL5bz0Q4Qj+5ckasSV0rGtOA9rOOjcqoV9N4sf?= =?us-ascii?Q?M+cfmae/D2kxnFgsG98uWXIubcfZHOYstWL42IqjZP4/xMkzOFRXx+MkAj9a?= =?us-ascii?Q?IvnxrK3yCzWHTGO4gdGq+YbA7JeDviGWxbreSg0KAWXIsMijs5A9aBLuvICa?= =?us-ascii?Q?vbDBwFhVuSIUMNu6NVHOuq/KXbq2vzB2rbN09+Y5doOFg+G1JM4bRukD3L9Z?= =?us-ascii?Q?wWArFodNO7gpsQpKzsY+pA=3D=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-c704e.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR17MB5122.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ad9455cf-855c-4118-ab63-08d9fb3a38d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2022 04:16:12.9459 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR17MB1048 Subject: [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-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: 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. 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)); -- 2.30.1 _______________________________________________ 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".