[FFmpeg-devel,5/5] avformat/mp3dec: require 90% of a file to be mp3 if only 1 mp3 frame is found in sequence

Submitted by Michael Niedermayer on May 12, 2018, 4:33 p.m.

Details

Message ID 20180512163329.18380-5-michael@niedermayer.cc
State Accepted
Commit cadf7a7f3901bbcacbb21fe33b73477199dd2474
Headers show

Commit Message

Michael Niedermayer May 12, 2018, 4:33 p.m.
This eliminates several low score detections of non mp3 files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mp3dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Aman Gupta May 12, 2018, 6:52 p.m.
On Sat, May 12, 2018 at 9:33 AM, Michael Niedermayer <michael@niedermayer.cc
> wrote:

> This eliminates several low score detections of non mp3 files
>

Thanks for working on this. Spurious mp3 detection has been a real headache.

Aman


>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mp3dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> index d419f8c9fe..ef884934e1 100644
> --- a/libavformat/mp3dec.c
> +++ b/libavformat/mp3dec.c
> @@ -112,7 +112,7 @@ static int mp3_read_probe(AVProbeData *p)
>      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 < 2*max_framesizes) return 1;
> +    else if(max_frames>=1 && p->buf_size < 10*max_framesizes) return 1;
>      else                   return 0;
>  //mpegps_mp3_unrecognized_format.mpg has max_frames=3
>  }
> --
> 2.17.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Michael Niedermayer May 19, 2018, 8:18 p.m.
On Sat, May 12, 2018 at 06:33:29PM +0200, Michael Niedermayer wrote:
> This eliminates several low score detections of non mp3 files
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mp3dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

please report any cases this makes worse with CC to me

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index d419f8c9fe..ef884934e1 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -112,7 +112,7 @@  static int mp3_read_probe(AVProbeData *p)
     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 < 2*max_framesizes) return 1;
+    else if(max_frames>=1 && p->buf_size < 10*max_framesizes) return 1;
     else                   return 0;
 //mpegps_mp3_unrecognized_format.mpg has max_frames=3
 }