From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 20BB74E245 for ; Thu, 15 Jan 2026 05:32:20 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'6jzqLfFCs+IwXGqI+ph8XsnFKXR4TX+IedSap7TAb54=', expected b'oi6EskdWPwOfPUnJ6artPZ8Vq+v85JyAW56+UjNL3qI=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1768455103; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=6jzqLfFCs+IwXGqI+ph8XsnFKXR4TX+IedSap7TAb54=; b=kYz2z6A1z8CHw0u87KLUcs26U2sZ5Bd83559u7DExws/34kLUE+m5V3dF6wZ589FQsM8b v6frsdro6t7VFy9OOfc7uWQUqAVBdZo3KUXLnwAwI6A+2/RshpQ+15Rg7rwwUBYz7XKrBig j0f9pOvCZ7KGs8rMhgiXjYsDA8C/jKEskfoy8vBIa83QRdKjRYYsg6+ALDXEFZvnSIYfGT+ K3DBPPEGHkVVqLQ97sj+6I/GHiotlcKXMHNfGv7dFj4OzV/LB1VBEyeGKRrcRulOWkyUobR vv47aB36G/kMr+57zk6eW3JB6/gFYGxje/bZ4ULP65ZQF2+jcO76GQoziikA== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 21D0A690E24; Thu, 15 Jan 2026 07:31:43 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1768455059; b=QrWOIUYACnRJc1eiC0a+ozteAvaTBU5gwFfJk9CV/Y+1svrVn0tik919ABtqFX1uawdWJ Cy6LDk19NVtfiJTz8JOZmG2mgpsXZ2XSHdc1OrVIpVUDOkDIVx5GlydbVZcneNmzjgReZP5 yctu6mejo4AJB1zvvdqI8Iq4e5jhafeHAC3Li2mPwckjFBf/aCcl8oCLNxboP0YAi0p0Gmw E4/42DcmNf6BEqmJNUs9lPnophqlpLdM72LedposJ2StwzYwi8j6rLgTaVfsNHubdPzyZZq XCl6S3xPQ2iSt5DMSzvAjSIiMmVAvdWncXWq04QYtBGGMjO+174JWOszJkhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1768455059; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=+OgTKAsFWhUI60BEhK1cHY9KFj0HZ3u3gas6+IzKHbg=; b=IPjLrmpJBtdiRW1sU9whYSnW4qsFTgwT9T0y7TfrvzRbKviEQFJ4etIR5QljgfXHApjNb kYpTngTulihYzVtDFJo5VM/B+NAojuNcK/aw/XuY9DyHdRfBPV/CuBPIyaDZZHcM+NfycNU HBAly7nR0r6MUXZ+vGTfSKafvAMLL+HdEdP1umVhl0Epv7sWqK3O+mGLALsPlTivNHDtzJT rNm3tEURvRgoA+ByPIXpeOH8DGnO3gUsNIJ0bXXgDgSuMXLsCOEPw+H2fLMTVvy6XFmwbAP zp11iAVzAQLmRDoGe4jkYm4p5/yKjo7+5gpNIOPCvaj+kq6E/wS5gmvPv9PA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1768455045; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=oi6EskdWPwOfPUnJ6artPZ8Vq+v85JyAW56+UjNL3qI=; b=ux2EjCcgjnmjn/gTwsUOXLXR33jweY7jR4sIm47qdjuNMY1ZTw4Nn9YsIsL5LuhxdaxCS F2rH6gEcz0/1hA+JGmZd3/4MpIwsf0d2adIEyCOstDRblhKRPwNysUS57/5yU6joDDHQjut lG1bxqOA186A/sUAXjkFmjvRkSXF/QJuV1u2RuviXtjE1w0S4BiiBcF2t2W8TsPpyrRgEAH vBBeBwFRjhtHHdIgI6EApItMne8Kh9fcGfk01QFDw+kpd5eD0AXRBYu1AlErk+97xY8My/7 0DbVTmtfXsZgTfobIGz4aOoGL2Yn+s+ZppjltD53a+E78Lk+tRo1jWxHiO7Q== Received: from f7c34508609e (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id F3D53690D96 for ; Thu, 15 Jan 2026 07:30:44 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Jan 2026 05:30:44 -0000 Message-ID: <176845504547.25.17781000858282546285@4457048688e7> Message-ID-Hash: RASOLRBJYWWSQS6QPJVNDINKBLTNU7P5 X-Message-ID-Hash: RASOLRBJYWWSQS6QPJVNDINKBLTNU7P5 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] lavf/aacdec: improve probe for AAC files with ID3v2 tags (PR #21472) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jun Zhao via ffmpeg-devel Cc: Jun Zhao Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21472 opened by Jun Zhao (mypopydev) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21472 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21472.patch The AAC probe was returning low score (1) for valid ADTS AAC files starting with ID3v2 tags, common in HLS streams, triggering: "Format aac detected only with low score of 1, misdetection possible!" Fix by skipping ID3v2 tags at the beginning and between ADTS frames during probing, similar to mp3_read_probe() in mp3dec.c. Signed-off-by: Jun Zhao >>From 1b222f5de992ccf36f1cc3573180286d3a4cd068 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Thu, 15 Jan 2026 12:54:22 +0800 Subject: [PATCH] lavf/aacdec: improve probe for AAC files with ID3v2 tags The AAC probe was returning low score (1) for valid ADTS AAC files starting with ID3v2 tags, common in HLS streams, triggering: "Format aac detected only with low score of 1, misdetection possible!" Fix by skipping ID3v2 tags at the beginning and between ADTS frames during probing, similar to mp3_read_probe() in mp3dec.c. Signed-off-by: Jun Zhao --- libavformat/aacdec.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index fef3c69f0b..b87619ec7c 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -40,15 +40,39 @@ static int adts_aac_probe(const AVProbeData *p) const uint8_t *buf2; const uint8_t *buf; const uint8_t *end = buf0 + p->buf_size - 7; + int id3_skip = 0; buf = buf0; + // Skip ID3v2 tags at the beginning to find the actual ADTS data + while (buf + ID3v2_HEADER_SIZE < end && + ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) { + int taglen = ff_id3v2_tag_len(buf); + if (id3_skip + taglen > p->buf_size) + break; + id3_skip += taglen; + buf = p->buf + id3_skip; + } + + // Update buf0 to point after ID3v2 tags for first_frames calculation + buf0 = buf; + for (; buf < end; buf = buf2 + 1) { buf2 = buf; for (frames = 0; buf2 < end; frames++) { uint32_t header = AV_RB16(buf2); if ((header & 0xFFF6) != 0xFFF0) { + // Skip embedded ID3v2 tags (common in HLS AAC streams) + if (buf2 + ID3v2_HEADER_SIZE < end && + ff_id3v2_match(buf2, ID3v2_DEFAULT_MAGIC)) { + int id3len = ff_id3v2_tag_len(buf2); + if (buf2 + id3len < end) { + buf2 += id3len; + frames--; // compensate for the frames++ in the loop + continue; + } + } if (buf != buf0) { // Found something that isn't an ADTS header, starting // from a position other than the start of the buffer. @@ -75,6 +99,9 @@ static int adts_aac_probe(const AVProbeData *p) return AVPROBE_SCORE_EXTENSION; else if (max_frames >= 3) return AVPROBE_SCORE_EXTENSION / 2; + // If file starts with ID3v2 and we found ADTS frames after it, boost score + else if (id3_skip > 0 && max_frames >= 1) + return AVPROBE_SCORE_EXTENSION / 2; else if (first_frames >= 1) return 1; else -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org