Vous êtes sur la page 1sur 6

Note from MediaInfo author: this document was written by someone else. I provide no support about it.

Author: Anonymous Licence: Public domain

MediaInfo Commmand Line Interface


MediaInfo GUI provides multiple ways to display the attributes of an audio visual file. MediaInfo !ommand Line Interface"!LI# provides the additional capability to $uery the values of specific attributes of an audio video file% which then allows these values to be used within batch files to determine the appropriate processin& of the file. 'or e(ample when convertin& a file with ffmpe&% if the audio or video stream is already encoded in the tar&et format then the copy option can be used in place of the tar&et codec option used for other stream formats. )imilarly for e(ample the e(istin& audio stream bitrate can be used to set the tar&et bit rate% rather than settin& a fi(ed value that may be &reater or less than the source bitrate. )ince the GUI and !LI use different versions of mediainfo.e(e% and the GUI.e(e installs into !:*Pro&ram 'iles% the best bet is to un+ip the command line !LI.+ip files into !:*pro&rams*mediainfo,cli*.

The Command Line Options


-he !LI command line with its options would then be: !:*pro&rams*mediainfo,cli*mediainfo.e(e .h the command line options !:*pro&rams*mediainfo,cli*mediainfo.e(e ..0ersion version and e(it !:*pro&rams*mediainfo,cli*mediainfo.e(e avfile 1ey attributes of avfile !:*pro&rams*mediainfo,cli*mediainfo.e(e .f avfile the attributes of avfile !:*pro&rams*mediainfo,cli*mediainfo.e(e ..help.Inform the .2Inform3 option ../ for a description of ../ display the Mediainfo ../ for a listin& of the ../ for a listin& of all ../ for a description of

!:*pro&rams*mediainfo,cli*mediainfo.e(e ..Info.Parameters ../ for a listin& of the attributes available as parameters with the ..Inform3 option. An abbreviated list of 1ey attributes is provided in Appendi( A !:*pro&rams*mediainfo,cli*mediainfo.e(e ..Inform3section4template avfile ../ to output the specified section and template values of attributes of avifile !:*pro&rams*mediainfo,cli*mediainfo.e(e ..Inform35section46file: templatefile avfile ../ to output the values of avifile attributes specified in the section and templatefile. If section is not specified in the command line it must be specified in the templatefile. )ections may be: General% 0ideo% Audio% -e(t% !hapter% Ima&e% Menu

-emplates are of the form: 5te(t67parameter75te(t657parameter765te(t6... -emplatefiles contain: 5section465te(t67parameter75te(t657parameter765te(t6... -e(t may include: *r*n to be&in a newline. "carria&e return 89 and linefeed 8A#

Additionally the options ..:utput3;-ML and or ..Lan&ua&e3raw may be added to the command to force output in ;-ML ta& format or internal te(t% however they do not wor1 with the ..Inform options% and the ;-ML option does not seem to wor1 with the other options.

Command Line Examples


Usin& the template option for e(ample: !:*pro&rams*mediainfo,cli*mediainfo.e(e <..Inform3General4'ilename is: 7'ileName 7< <!:*videos*U)A ;oliday.mp&< will output: 'ilename is: U)A ;oliday And usin& the templatefile option for e(ample: If the file !:*temp*template.t(t contains: General4'ile is:7'ileName7 0ideo4=esolution is:7>idth7(7;ei&ht7*r*nAspect 79isplayAspect=atio )trin&7*r*n Audio4!odec 3 7'ormat7 and the command is: !:*pro&rams*mediainfo,cli*mediainfo.e(e ..Inform3file: <!:*videos*U)A ;oliday.mp&< then the output will be: 'ile is:;oliday =esolution is:?@8(AB8 Aspect A C !odec 3 A!.C !:*temp*template.t(t

Important Notes
Note that: if the options or filenames in the command contain blan1s they must be enclosed in $uotes <. each 7parameter7 must match the spellin& and capitali+ation shown in the ..Info.Parameters listin&. parameters followed by )trin& will convert numeric values to fractional form e&: D.CCC will be A C the template option may only be used for the output of one section the templatefile option must be used for output from multiple sections a section may only be specified once in a templatefile. e&: if a second 0ideo4 line is used it will be i&nored. multiple parameters may be specified for a section e&: 5te(t67parmD75te(t6 7parm@75te(t6...

the blan1 spaces followin& parameters in a templatefile are si&nificant on output. 'or e(ample the blan1 space between ;oliday and =esolution in the e(ample was due to a space followin& 7'ileName7 in the template.t(t file. / outputfilename at the end of the command line will pipe output to a file. if the commands are used within a .bat file% the parameters must be enclosed in double 7 si&ns ie: 77parameter77

Using the CLI Output in Batch Processing


)ince the MediaInfo output may be piped to a file% any attribute value can be output and read from the file by a .bat file and used to ma1e processin& decisions. -he followin& code may be used in a .bat file to &enerate a file with an attribute value from a 7D input file% access the file to e(tract the value% and then use it to determine subse$uent processin&: ................................................................................ : Generate file !:*value.t(t with the value for 7parameter7 in section4 !:*Pro&rams*mediainfo,cli*mediainfo.e(e ..Inform3)ection477parameter77 7D / !:*value.t(t : =ead the value from !:*value.t(t and )et myvar e$ual to it. for f <to1ens3E< 77A in "Ftype !:*value.t(tF# do set my0ar377A :!ompare the value now in myvar to a <tar&et value< and control processin&. if <.7myvar7< 33 <.tar&et value< statement ................................................................................

Batch Processing Example


If a file !:*video*U)A ;oliday.mp& contains A!.C audio% then this may be determined and used in the followin& !:*conversion.bat called usin&: !:*conversion.bat !:*video*U)A ;oliday.mp& ...conversion.bat.................................................. Gecho off : Get the codec !:*Pro&rams*mediainfo,cli*mediainfo.e(e ..Inform3Audio477!odec77 7D / !:*value.t(t : =ead it for f <to1ens3E< 77A in "Ftype !:*miresult.t(tF# do set my0ar377A : -est for A!.C if <.7myvar7< 33 <.A!.C< &oto :A!C : non.A!.C processin& follows ffmpe&..... &oto :e(it :A!C : A!.C processin& follows ffmpe&.... :e(it .....................................................................

Appendix A
-he followin& pa&es contain an abbreviated set of parameter names and e(amples of possible tar&et values &enerated by MediaInfo,!LI from actual av files. 'or use with the 2Inform3 option in .bat files.

Section;%Parameter% Description General;


CompleteName FileName FileExtension Format Format-*nfo File&i.e File&i.e-&tring File&i.e-&tring4 File&i.e-&tring% File&i.e-&tring/ File&i.e-&tring4 9 ration 9 ration-&tring 9 ration-&tring4 9 ration-&tring% 9 ration-&tring/ Complete name (Folder\Name.Ext) File name only File extension only eg: mpg mkv avi Format sed eg: !"E#$% !atroska *nfo abo t Format File si.e in bytes File si.e (wit, meas re) File si.e (wit, meas re8 4 digit mini) File si.e (wit, meas re8 % digit mini) File si.e (wit, meas re8 / digit mini) File si.e (wit, meas re8 4 digit mini) "lay time of t,e stream "lay time (formated) "lay time in : ::, !!mn &&s !!!ms "lay time in format : ::, !!mn &&s "lay time in format : :::!!:&&.!!! 4/011%2 4.46 !i7 4 !i7 4.% !i7 4.46 !i7 4.406 !i7 %/0%%63 0mn /0s 0mn /0s 60ms 0mn /0s 20:/6.2 mpg8vob8ts !"E# )ideo 34/43545% 324 !i7 324 !i7 324 !i7 324 !i7 324.4 !i7 /10160 %0mn 3s %0mn 3s 40ms %0mn 3s %0:23.2 avi or mp4 !"E#$4 )is al

PossIble

Values

mpg or vob !"E#$"&

ts !"E#$'&

avi ()* ( dio )ideo *nterleave 426/6/1660 4 2%4 !i7 4 2%4 !i7 4 2%4 !i7 4 2%4 !i7 4 2%4.2 !i7 4503240 /1mn %%s /1mn %%s %6ms /1mn %%s /1:%%.2 mp4 only !"E#$4 )is al

mp4 !"E#$4

wmv +indows !edia

mkv !atroska

flv Flas, )ideo

Video;
Format Format-*nfo Format<)ersion Format<"rofile Format sed *nfo abo t Format )ersion of t,is format "rofile of t,e Format

mp4 or mkv wmv only ()C +)"% (dvan;ed )ideo Code; !ain=>4.n :ig,=>/.4 )<!"E#4-*&@()C

wmv only )C$4

flv only :.%0/ or )"0

)ersion % !ain=!ain !ain=:ig,

&treaming )ideo=>4 ?)*9 or 9?52 ?vi9 or 9iv? 5

&imple=>n

!"=!>

Code;*9 Code;*9-:int 9 ration 9 ration-&tring 9 ration-&tring4 9 ration-&tring% 9 ration-&tring/

Code; *9 (fo nd in some ;ontainers) ( ,int for t,is ;ode; *9 "lay time of t,e stream "lay time (formated) "lay time in : ::, !!mn &&s !!!ms "lay time in format : ::, !!mn &&s "lay time in format : :::!!:&&.!!!

!"4)

+)"%

+!)/ +!)/

6%1563 4%mn 1s 4%mn 1s 63ms 4%mn 1s 4%:42.2

Video;
7itAate<!ode 7itAate<!ode-&tring 7itAate 7itAate-&tring 7itAate<!inim m 7itAate<!inim m-&tring 7itAate<Nominal 7itAate<Nominal-&tring 7itAate<!axim m 7itAate<!axim m-&tring +idt, +idt,-&tring :eig,t :eig,t-&tring "ixel(spe;tAatio "ixel(spe;tAatio-&tring 9isplay(spe;tAatio 9isplay(spe;tAatio-&tring FrameAate<!ode FrameAate<!ode-&tring FrameAate FrameAate-&tring FrameCo nt &tandard Colorimetry &;an'ype &;an'ype-&tring &tream&i.e &tream&i.e-&tring &tream&i.e-&tring4 &tream&i.e-&tring% &tream&i.e-&tring/ &tream&i.e-&tring4 >ang age-&tring 7it rate mode ()7A8 C7A) 7it rate mode ()7A8 C7A) 7it rate in bps 7it rate (wit, meas rement) !inim m 7it rate in bps !inim m 7it rate (wit, meas rement) Nominal 7it rate in bps Nominal 7it rate (wit, meas rement) !axim m 7it rate in bps !axim m 7it rate (wit, meas rement) +idt, :eig,t "ixel (spe;t ratio "ixel (spe;t ratio 9isplay (spe;t ratio 9isplay (spe;t ratio Frame rate mode (CFA8 )FA) Frame rate mode (CFA8 )FA) Frame rate Frame rate Frame ;o nt N'&C or "(> C7A Constant /243344 / 241 Bbps )7A )ariable 45.1 !bps

42222222 42 222 Bbps

46443322 46.4 !bps

/%2 /%2 pixels %42 %42 pixels

042 042 pixels 432 432 pixels

624 624 pixels 432 432 pixels 2.121 4.663 40-1

6%2 6%2 pixels 432 432 pixels 4.435

6%2 6%2 pixels 560 560 pixels

4%32 4 %32 pixels 6%2 6%2 pixels 4

41%2 4 1%2 pixels 4232 4 232 pixels 4

&tream si.e in bytes

>ang age (f ll)

4.%5 5-4 CFA Constant 45.224 45.224 fps 500/3 N'&C 4:2%:22 "rogressive "rogressive //43111 /.46 !i7 (60C) / !i7 /.% !i7 /.46 !i7 /.405 !i7 Englis,

4./// 4-/

%/.160 %/.160 fps Component *nterla;ed *nterla;ed /5/03/02 //.6 !i7 (65C) /4 !i7 /4 !i7 //.6 !i7 //.6/ !i7 en$ s

%5 %5.222 fps "(>

%1.16 %1.162 fps

/2 /2.222 fps

1//%2423% 312 !i7 (31C) 312 !i7 312 !i7 312 !i7 312.2 !i7

Audio;
Format Format-*nfo Format<)ersion Format<"rofile Code;*9 Code;*9-:int 9 ration 9 ration-&tring 9 ration-&tring4 9 ration-&tring% 9 ration-&tring/ 7itAate<!ode 7itAate<!ode-&tring 7itAate 7itAate-&tring C,annel(s) C,annel(s)-&tring C,annel"ositions &amplingAate &amplingAate-&tring &tream&i.e &tream&i.e-&tring &tream&i.e-&tring4 &tream&i.e-&tring% &tream&i.e-&tring/ &tream&i.e-&tring4 Format sed *nfo abo t Format )ersion of t,is format "rofile of t,e Format Code; *9 (fo nd in some ;ontainers) ( ,int for t,is ;ode; *9 "lay time of t,e stream "lay time (formated) "lay time in : ::, !!mn &&s !!!ms "lay time in format : ::, !!mn &&s "lay time in format : :::!!:&&.!!! 7it rate mode ()7A8 C7A) 7it rate mode ()7A8 C7A) 7it rate in bps 7it rate (wit, meas rement) N mber of ;,annels N mber of ;,annels "osition of ;,annels &ampling rate in B:. &tream si.e in bytes !"E# ( dio !"E# ( dio (C$/ ( dio Coding / 9'& 9igital ',eater &ystems ((C (dvan;ed ( dio Code; )ersion % or 4 >C )orbis +!(%

)ersion 4 >ayer %

)ersion 4 or % >ayer / !"/ 4/205// %4mn 40s %4mn 40s 5//ms %4mn 40s %4:46.2 )7A )ariable 444524 44% Bbps % % ;,annels

9olby 9igital %222 or (<(C/

(<)@A7*&

>4 or >% 404

/2333 /2s 333ms /2s 333ms /2s 333ms 22:/4.2 C7A Constant 0/116 04.2 Bbps % % ;,annels

4%3222 4%3 Bbps % % ;,annels >A 43222 43.2 B:.

%%252 %%.25 B:. 104435 1/1 Bi7 (%%C) 1/1 Bi7 1/1 Bi7 1/1 Bi7 1/1.2 Bi7

44422 44.4 B:. 44%5%64% 42.6 !i7 (%4C) 44 !i7 44 !i7 42.6 !i7 42.6/ !i7

/34222 /34 Bbps 0 0 ;,annels Front: > C A8 Aear: > A8 >FE 43222 43.2 B:.

603222 603 Bbps

Menu;
Format Format sed eg: 9)9$)ideo 9)9$)ideo

Vous aimerez peut-être aussi