Is there a quick way to determine the type of a file?

Help
Dust
2013-04-02
2013-04-04
  • Dust

    Dust - 2013-04-02

    Hello

    Is there a quick way to determine if a file is video or audio with mediainfo, without reading all the properties? So I could write

    if [ file is video ]
    then
      mediainfo --video-options file
    elif [ file is audio ]
    then
      mediainfo --audio-options file
    fi
    
     
  • Jerome Martinez

    Jerome Martinez - 2013-04-02

    Some "magic":
    mediainfo "--Inform=General;%VideoCount%" file
    mediainfo "--Inform=General;%AudioCount%" file

    return a value superior or egal to 1 if there is a video (or an audio) stream, else empty.
    You need to "transform" yourself such returned value to true/false

     
  • Jerome Martinez

    Jerome Martinez - 2013-04-02

    Add --ParseSpeed=0, it is fast parsing and you don't need "advanced" values, so what is not present in the output (e.g. GOP size) is not a problem for you.

     
  • Dust

    Dust - 2013-04-02

    Ok, it works a bit faster. Thank you.

    For about a hundred files

    mediainfo --Output='General;%VideoCount%'
    18.171s

    mediainfo --Inform='General;%VideoCount%'
    18.104s

    mediainfo --ParseSpeed=0 --Inform='General;%VideoCount%'
    17.401s

    But these options are not documented in mediainfo --help. =)
    I have v0.7.61. Is there any other documentation?

     
  • Jerome Martinez

    Jerome Martinez - 2013-04-02

    --Output and --Inform are same, sorry, I forgot to trash "inform" word.
    I am a bit disappointed about speed improvement, it does not help a lot with your files.

    Documentation definitely sucks, I'll write it when people stop to request new features for yesterday.

     
  • Dust

    Dust - 2013-04-04

    The speed impact is really not large. Bug generally I'm quite satisfied with the performance. Anyway, your program works very fast.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks