Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
       [not found] <20250811083755.CDB4D68BEE9@ffbox0-bg.ffmpeg.org>
@ 2025-08-11 10:51 ` Michael Niedermayer
  2025-08-11 12:04   ` Zhao Zhili
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Niedermayer @ 2025-08-11 10:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 2911 bytes --]

On Mon, Aug 11, 2025 at 11:37:55AM +0300, quink wrote:
> 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)

why is this needed ?

Naively i would expect that the probe code would detect a mp3 stream like this
based on max_frames
why does that fail ?
as what is teh stream detected instead ?
maybe whatever detects it, is wrong instead and can be improved by not missdetecting it

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If the United States is serious about tackling the national security threats 
related to an insecure 5G network, it needs to rethink the extent to which it
values corporate profits and government espionage over security.-Bruce Schneier

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11 10:51 ` [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212) Michael Niedermayer
@ 2025-08-11 12:04   ` Zhao Zhili
  2025-08-11 19:23     ` Michael Niedermayer
  0 siblings, 1 reply; 11+ messages in thread
From: Zhao Zhili @ 2025-08-11 12:04 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> On Aug 11, 2025, at 18:51, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
> On Mon, Aug 11, 2025 at 11:37:55AM +0300, quink wrote:
>> 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)
> 
> why is this needed ?
> 
> Naively i would expect that the probe code would detect a mp3 stream like this
> based on max_frames
> why does that fail ?
> as what is teh stream detected instead ?
> maybe whatever detects it, is wrong instead and can be improved by not missdetecting it

probe just report invalid data:

Probing mp3 score:25 size:2048
Probing h263 score:25 size:4096
Probing mp3 score:25 size:4096
Probing h263 score:25 size:8192
Probing mp3 score:25 size:8192
Probing h263 score:25 size:16384
Probing mp3 score:25 size:16384
Probing h263 score:25 size:20160
Probing mp3 score:25 size:20160
Probing h263 score:25 size:20160
Probing mp3 score:25 size:20160
[AVIOContext @ 0x127f04ac0] Statistics: 20160 bytes read, 0 seeks

3ac558a6ebf467b42e4a42be3014c6c5.mp3: Invalid data found when processing input

These files are only 1 to 2 seconds contains a single English word. I think the size of file
is one of the reason of failed to detect.

> 
> thx
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> If the United States is serious about tackling the national security threats 
> related to an insecure 5G network, it needs to rethink the extent to which it
> values corporate profits and government espionage over security.-Bruce Schneier
> _______________________________________________
> 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".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11 12:04   ` Zhao Zhili
@ 2025-08-11 19:23     ` Michael Niedermayer
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2025-08-11 19:23 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 3918 bytes --]

On Mon, Aug 11, 2025 at 08:04:02PM +0800, Zhao Zhili wrote:
> 
> 
> > On Aug 11, 2025, at 18:51, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > 
> > On Mon, Aug 11, 2025 at 11:37:55AM +0300, quink wrote:
> >> 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)
> > 
> > why is this needed ?
> > 
> > Naively i would expect that the probe code would detect a mp3 stream like this
> > based on max_frames
> > why does that fail ?
> > as what is teh stream detected instead ?
> > maybe whatever detects it, is wrong instead and can be improved by not missdetecting it
> 
> probe just report invalid data:
> 
> Probing mp3 score:25 size:2048
> Probing h263 score:25 size:4096
> Probing mp3 score:25 size:4096
> Probing h263 score:25 size:8192
> Probing mp3 score:25 size:8192
> Probing h263 score:25 size:16384
> Probing mp3 score:25 size:16384
> Probing h263 score:25 size:20160
> Probing mp3 score:25 size:20160
> Probing h263 score:25 size:20160
> Probing mp3 score:25 size:20160
> [AVIOContext @ 0x127f04ac0] Statistics: 20160 bytes read, 0 seeks
> 
> 3ac558a6ebf467b42e4a42be3014c6c5.mp3: Invalid data found when processing input
> 
> These files are only 1 to 2 seconds contains a single English word. I think the size of file
> is one of the reason of failed to detect.

they are valid h263 ?

if not, can teh h263 probe test be improved so they are not detected as h263?

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11 10:49           ` Zhao Zhili
@ 2025-08-11 10:53             ` Nicolas George
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas George @ 2025-08-11 10:53 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Zhao Zhili (HE12025-08-11):
> I think you missed this line:
> 
> &gt; Chrome recognize these files as valid.

I missed it indeed. Sorry. Add the missing s at the end of the verb and
I have no objection.

> And I think it's not uncommon for FFmpeg being the only known (opensource)
> software to support a lot of non-standard files.

There is a significant difference between being the only generic
software understanding a non-public format used internally by something
else and accepting — and thus encouraging — non-standard variants of
well-established formats produced by bogus software.

Regards,

-- 
  Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11 10:17         ` Nicolas George
@ 2025-08-11 10:49           ` Zhao Zhili
  2025-08-11 10:53             ` Nicolas George
  0 siblings, 1 reply; 11+ messages in thread
From: Zhao Zhili @ 2025-08-11 10:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

&gt; Zhao Zhili (HE12025-08-11):
&gt; &gt; Commit has been updated as:
&gt;&nbsp;
&gt; Thanks. But we still need to know if some other software recognizes
&gt; these files. FFmpeg is not in the business to decide to recognize widely
&gt; invalid files on its own.
&gt;&nbsp;
&gt; If no other software already recognizes these files without forcing the
&gt; format, then we should not either.


I think you missed this line:


&gt; Chrome recognize these files as valid.


And I think it's not uncommon for FFmpeg being the only known (opensource)
software to support a lot of non-standard files.


&gt;&nbsp;
&gt; Regards,
&gt;&nbsp;
&gt; --
&gt; Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11 10:13       ` Zhao Zhili
@ 2025-08-11 10:17         ` Nicolas George
  2025-08-11 10:49           ` Zhao Zhili
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas George @ 2025-08-11 10:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Zhao Zhili (HE12025-08-11):
> Commit has been updated as:

Thanks. But we still need to know if some other software recognizes
these files. FFmpeg is not in the business to decide to recognize widely
invalid files on its own.

If no other software already recognizes these files without forcing the
format, then we should not either.

Regards,

-- 
  Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11  9:51     ` Nicolas George
@ 2025-08-11 10:13       ` Zhao Zhili
  2025-08-11 10:17         ` Nicolas George
  0 siblings, 1 reply; 11+ messages in thread
From: Zhao Zhili @ 2025-08-11 10:13 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> On Aug 11, 2025, at 17:51, Nicolas George <george@nsup.org> wrote:
> 
> Zhao Zhili (HE12025-08-11):
>> Any suggestions?
> 
> “Recognize files …ing with … as MP3 with score …”
> 
>>> What other software manages to recognize these files as valid?
>> ffplay -f mp3 works as expected.
> 
> ffplay is not other software, and it cannot be said to recognize the
> file if you have to specify “-f mp3”.

Commit has been updated as:

avformat/mp3dec: Recognize files start with LAME3.100 as mp3

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. Chrome recognize these files as valid.


> 
> Regards,
> 
> -- 
>  Nicolas George
> _______________________________________________
> 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".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11  9:46   ` Zhao Zhili
@ 2025-08-11  9:51     ` Nicolas George
  2025-08-11 10:13       ` Zhao Zhili
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas George @ 2025-08-11  9:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Zhao Zhili (HE12025-08-11):
> Any suggestions?

“Recognize files …ing with … as MP3 with score …”

> > What other software manages to recognize these files as valid?
> ffplay -f mp3 works as expected.

ffplay is not other software, and it cannot be said to recognize the
file if you have to specify “-f mp3”.

Regards,

-- 
  Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
  2025-08-11  8:40 ` Nicolas George
@ 2025-08-11  9:46   ` Zhao Zhili
  2025-08-11  9:51     ` Nicolas George
  0 siblings, 1 reply; 11+ messages in thread
From: Zhao Zhili @ 2025-08-11  9:46 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> On Aug 11, 2025, at 16:40, Nicolas George <george@nsup.org> wrote:
> 
> quink (HE12025-08-11):
>> 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>
> 
> The commit message should explain better what the commit does.

Any suggestions?

> 
> What other software manages to recognize these files as valid?

ffplay -f mp3 works as expected.

> 
> Regards,
> 
> -- 
>  Nicolas George
> _______________________________________________
> 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".

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
       [not found] <20250811083754.1578368D1B5@ffbox0-bg.ffmpeg.org>
@ 2025-08-11  8:40 ` Nicolas George
  2025-08-11  9:46   ` Zhao Zhili
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas George @ 2025-08-11  8:40 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

quink (HE12025-08-11):
> 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>

The commit message should explain better what the commit does.

What other software manages to recognize these files as valid?

Regards,

-- 
  Nicolas George
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212)
@ 2025-08-11  8:37 quink
  0 siblings, 0 replies; 11+ messages in thread
From: quink @ 2025-08-11  8:37 UTC (permalink / raw)
  To: ffmpeg-devel

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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-08-11 19:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250811083755.CDB4D68BEE9@ffbox0-bg.ffmpeg.org>
2025-08-11 10:51 ` [FFmpeg-devel] [PATCH] avformat/mp3dec: Workaround mp3 detection failure (PR #20212) Michael Niedermayer
2025-08-11 12:04   ` Zhao Zhili
2025-08-11 19:23     ` Michael Niedermayer
     [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
2025-08-11  8:37 quink

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