From: quink <code@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212) Date: Mon, 11 Aug 2025 11:37:54 +0300 (EEST) Message-ID: <20250811083754.426DA68D239@ffbox0-bg.ffmpeg.org> (raw) PR #20212 opened by quink URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20212 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20212.patch A set of files begins with the following byte sequence. 00000000 4c 41 4d 45 33 2e 31 30 30 aa aa aa aa aa aa aa |LAME3.100.......| 00000010 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa |................| * It seems they are encoded with lame, but missing header bytes at the beginning. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> From e24f7b8d0fbc4295b3dfc9832d7b552086f45ff0 Mon Sep 17 00:00:00 2001 From: Zhao Zhili <zhilizhao@tencent.com> Date: Mon, 11 Aug 2025 15:23:36 +0800 Subject: [PATCH] avformat/mp3dec: Workaround mp3 detection failure A set of files begins with the following byte sequence. 00000000 4c 41 4d 45 33 2e 31 30 30 aa aa aa aa aa aa aa |LAME3.100.......| 00000010 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa |................| * It seems they are encoded with lame, but missing header bytes at the beginning. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> --- libavformat/mp3dec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 31eeb68ebb..fd692a9c76 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -121,8 +121,11 @@ static int mp3_read_probe(const AVProbeData *p) // issues with MPEG-files! if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1; else if (max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION; - else if (max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2; - else if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) + else if (max_frames>=4 && p->buf_size < 2*max_framesizes) { + if (!memcmp(p->buf, "LAME3.100", sizeof("LAME3.100") - 1)) + return AVPROBE_SCORE_EXTENSION - 2; + return AVPROBE_SCORE_EXTENSION / 2; + } else if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) return p->buf_size < PROBE_BUF_MAX ? AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2; else if (first_frames > 1 && whole_used) return 5; else if (max_frames>=1 && p->buf_size < 10*max_framesizes) return 1; -- 2.49.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".
next reply other threads:[~2025-08-11 8:37 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-08-11 8:37 quink [this message] [not found] <20250811083754.1578368D1B5@ffbox0-bg.ffmpeg.org> 2025-08-11 8:40 ` Nicolas George 2025-08-11 9:46 ` Zhao Zhili 2025-08-11 9:51 ` Nicolas George 2025-08-11 10:13 ` Zhao Zhili 2025-08-11 10:17 ` Nicolas George 2025-08-11 10:49 ` Zhao Zhili 2025-08-11 10:53 ` Nicolas George [not found] <20250811083755.CDB4D68BEE9@ffbox0-bg.ffmpeg.org> 2025-08-11 10:51 ` Michael Niedermayer 2025-08-11 12:04 ` Zhao Zhili
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250811083754.426DA68D239@ffbox0-bg.ffmpeg.org \ --to=code@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git