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 DA1D34A2F6 for ; Tue, 26 Mar 2024 15:09:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C30A268D18A; Tue, 26 Mar 2024 17:09:55 +0200 (EET) Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F140168D07E for ; Tue, 26 Mar 2024 17:09:49 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id B408C4135C; Tue, 26 Mar 2024 15:09:48 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Tue, 26 Mar 2024 16:09:45 +0100 Message-Id: <20240326150946.314054-1-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 0/1] avcodec/h264_parser: fix start of packet for some broken 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: Nicolas Gaullier 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: This is a patch from my patch serie https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10999 Maybe it is easier to review it this way, independantly. This patch shows some benefits by itself, but most importantly, it is required for my patch serie to avoid any regression with some invalid streams. This patch is active in mpegts/h264 when the NAL Access Unit Delimiter is missing the zero_byte (= a invalid stream case). In such a case, if it happens that the last data byte from the previous frame is a null byte, this byte is "kidnaped" to form the full NAL_AUD... This is not good, but even worser, with my patch serie above applied, it means that the start of the editunit is in the previous frame, which means the pts has to be taken in it, which is not the expected behaviour in such a missleading scenario. Michael sent me a sample from the wild but it can't be shared, so here it is: I have another sample of my own with NAL_AUD missing zero_byte similarly, but it is missing the ending null byte, so I have patched/inserted the null byte (I shrinked the adaptation field) to show how the code behave. Sample original (invalid NAL_AUDs): https://0x0.st/Xs9Q.ts Same sample modified to exhibit the issue (invalid NAL_AUDs + an available null ending byte at 0x291F): https://0x0.st/Xs9j.ts I use this simple command line and then compare the xml, it seems quite clear: ffprobe xxx.ts -show_packets -show_data -print_format xml Nicolas Gaullier (1): avcodec/h264_parser: fix start of packet for some broken streams libavcodec/h264_parser.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.30.2 _______________________________________________ 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".