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 3A25F468C0 for ; Tue, 25 Jul 2023 00:01:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3BE868C7E8; Tue, 25 Jul 2023 03:01:37 +0300 (EEST) Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4804A68C702 for ; Tue, 25 Jul 2023 03:01:31 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 46459177444; Tue, 25 Jul 2023 02:01:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1690243290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=unsRwSoqEQiAsPnu8n4ei27PMpeCwJsLEIL+q+61bR8=; b=m8XQ6CDDxYnz0Lns4v4Pg63tx2o7HE4tp4O+V1pOluPi2CxEunI4exV7ah7h/vKN6+M9AA anxULuDBIY9rYtmIsbxm5mT2Kkw+Xs9lRLRCqfuqCfLQYI212hWv3KU8vc4w3qYVN48GET QQZ6R6tSt8igpoWcc8ksNIjGqpLyeiAr5LFAiIwlkcz2GbvYediO0bkcFbpzxEKCkeoUkK 9qUgxBechTyZefo2P/o/mHKMKSJGMMxi4UKkF2pE7fkqMs5GgPdqJLbGk5Z6NMapvHwEYb llB9L/rnXcG6DP3x5AVeNwWtjb5CQF55aqWN1aKGScA1slRVX61ENEzl7mFSWg== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Jul 2023 02:01:22 +0200 Message-Id: <20230725000122.35732-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/flvenc: write proper timestamps when muxing hevc 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 Cc: Timo Rothenpieler 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: --- libavformat/flvenc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 335d900415..41636ba1b8 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -863,6 +863,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) else flags_size = 1; + if (par->codec_id == AV_CODEC_ID_HEVC && pkt->pts != pkt->dts) + flags_size += 3; + if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { @@ -998,8 +1001,11 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) } else { av_assert1(flags>=0); if (par->codec_id == AV_CODEC_ID_HEVC) { - avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFramesX | frametype); // ExVideoTagHeader mode with PacketTypeCodedFramesX + int pkttype = (pkt->pts != pkt->dts) ? PacketTypeCodedFrames : PacketTypeCodedFramesX; + avio_w8(pb, FLV_IS_EX_HEADER | pkttype | frametype); // ExVideoTagHeader mode with PacketTypeCodedFramesX avio_write(pb, "hvc1", 4); + if (pkttype == PacketTypeCodedFrames) + avio_wb24(pb, pkt->pts - pkt->dts); } else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeCodedFrames | frametype); avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); -- 2.34.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".