Identify a file as a video file

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Identify a file as a video file

Post by JRL » Thu Sep 03, 2009 2:19 pm

I have a need to identify a file as being a video file or not a video file. The solution I came up with was to create a list of video file extensions and then compare the in-question file's extension to the list. If the extension is on the list, then the file is a video file.

This is, of course, a tepid solution. The file name has no real connection to the file contents so it is possible for this program to provide erroneous results.

Anyone have a better solution?

Here's what I have now.

Code: Select all

Let>TestFile=C:\MyVideoFile.avi
GoSub>IsItAVideoFile,TestFile
If>ItsAVideo=1
  MDL>%TestFile% is a video file
Else
  MDL>%TestFile% is NOT a video file
EndIf

//Usage
//GoSub>IsItAVideoFile,file name
SRT>IsItAVideoFile
  IfFileExists>IsItAVideoFile_var_1
    Let>VideoExtensionList=.3g2;.3gp;.3gp2;.3gpp;.3mm;.60d;.aep;.ajp;.amv;.amx;.arf;.asf;.asx;.avb;.avi;.avs;.axm;.bik;.bin;.bix;.box;.bsf;.byu;.camrec;.cvc;.d2v;.d3v;.dce;.dif;.dir;.divx;.dmb;.dpg;.dsy;.dv;.dvr-ms;.dvx;.dxr;.evo;.eye;.f4v;.fbr;.fbz;.fcp;.flc;.flh;.fli;.flv;.flx;.gl;.grasp;.gvi;.gvp;.hkm;.ifo;.imovieproj;.imovieproject;.ivf;.ivr;.ivs;.izz;.izzy;.lsf;.lsx;.m1pg;.m1v;.m21;.m2a;.m2t;.m2ts;.m2v;.m4e;.m4u;.m4v;.mgv;.mj2;.mjp;.mjpg;.mkv;.mnv;.mod;.modd;.moov;.mov;.movie;.mp21;.mp2v;.mp4;.mp4v;.mpe;.mpeg;.mpg;.mpg2;.mpv2;.mqv;.msdvd;.msh;.mswmm;.mts;.mtv;.mvb;.mvc;.mvd;.nsv;.nvc;.ogm;.ogv;.par;.pds;.piv;.playlist;.pmf;.prel;.pro;.prproj;.pva;.pxv;.qt;.qtch;.qtl;.qtz;.rcproject;.rdb;.rec;.rm;.rmvb;.roq;.rp;.rts;.rum;.rv;.sbk;.scm;.scn;.sfvidcap;.smi;.smil;.smk;.smv;.spl;.srt;.ssm;.str;.stx;.svi;.swf;.swi;.swt;.tda3mt;.tivo;.tod;.tp;.tpr;.trp;.ts;.vc1;.vdo;.veg;.vf;.vfw;.vgz;.vid;.viewlet;.viv;.vivo;.vlab;.vob;.vp6;.vp7;.vro;.w32;.wcp;.wm;.wmd;.wmmp;.wmv;.wmx;.wvx;.xvid;.yuv;.zm1;.zm2;.zm3;.zmv;
    Separate>IsItAVideoFile_var_1,.,extension
    Separate>VideoExtensionList,.%extension_2%;,ext_search
    If>ext_search_count>1
      Let>ItsAVideo=1
    Else
      Let>ItsAVideo=0
    EndIf
  Else
    MDL>File:%CRLF%%IsItAVideoFile_var_1%%CRLF%Not Found...
  EndIf
END>IsItAVideoFile

observer
Junior Coder
Posts: 44
Joined: Tue Aug 18, 2009 7:55 pm

Post by observer » Fri Sep 04, 2009 6:54 pm

Hello, JRL
Try this app http://mark0.net/soft-trid-e.html. It can be useful for files without extension.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts