[FFmpeg-devel] improved DV probe score patch BROKES detecting 1-frame DV

Reimar Döffinger Reimar.Doeffinger
Fri Sep 25 14:18:41 CEST 2009


On Fri, Sep 25, 2009 at 11:48:55AM +0300, Maksym Veremeyenko wrote:
> I always thought that format detection for ffmpeg is prioritized in way:
> 1. "-f <format>" input format redefinition
> 2. input file extension
> 3. stream probe
> Why does it perform stream probe if input file extension is defined?

No, no idea where you got that from.
Extension does not matter for formats that have a probe function (which
may be a bad idea), and for formats that do not have a probe function it
sets the score to 50 (which seems a bit high to me).
Anyway, once more the MPEG detection strikes (if someone can find the
motivation, extending probetest to check that no two probe functions
return the same value even if <= 25 might be a good idea).
Of course the DV probe function probably could be improved to reliably
return a higher score for single-frame DVs, but that is a bit more
effort :-).
E.g. this change makes it work:
Index: libavformat/mpeg.c
===================================================================
--- libavformat/mpeg.c  (revision 20013)
+++ libavformat/mpeg.c  (working copy)
@@ -78,7 +78,7 @@
 
 //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d len:%d\n", sys, priv1,
 //pspack,vid, audio, p->buf_size);
     if(sys>invalid && sys*9 <= pspack*10)
-        return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
+        return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4-1; // +1 for .mpg
     if(priv1 + vid + audio > invalid && (priv1+vid+audio)*9 <= pspack*10)
         return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
     if((!!vid ^ !!audio) && (audio > 4 || vid > 1) && !sys && !pspack && p->buf_size>2048 && vid + audio > invalid) /* PES stream */



More information about the ffmpeg-devel mailing list