PHP Classes


Recommend this page to a friend!

      Media Info  >  All threads  >  MediaInfo  >  (Un) Subscribe thread alerts  
Summary:Working with mediaInfo
Author:Darren Conyard
Date:2012-12-04 17:04:55
Update:2012-12-06 14:48:14

  1. MediaInfo   Reply   Report abuse  
Darren Conyard - 2012-12-04 17:04:56
Hi Gianluca,

I was taking a look at this class and I was unable to get this to work from my localhost. I am using a windows machine and I was wondering if there are some details you need to take into consideration before using this class?

I have installed mediaInfo on my machine and I have completed the basic setup and it runs fine if I run the executable file separately. However if i run the script the variable mediainfo within the construct function always defaults to empty resulting in header 'mediainfo not available'.

Do you have to be running Debian or Ubuntu in order for this to work?

Many Thanks

Darren Conyard

  2. Re: MediaInfo   Reply   Report abuse  
Gianluca Zanferrari - 2012-12-05 08:38:20 - In reply to message 1 from Darren Conyard
I use xubuntu. Call de mediainfo inside windows with the whole path. Maybe is that the problem

  3. Re: MediaInfo   Reply   Report abuse  
Darren Conyard - 2012-12-06 13:18:16 - In reply to message 2 from Gianluca Zanferrari
Hi Gianluca,

Thanks for getting back to me, So far I have tried shell_exec() with type -p and with the relative file path '../../../../../MediaInfo/MediaInfo.exe' and also with absolute file path. Within the command prompt I am able to write type mediainfo.exe and the contents of the file are displayed but within command prompt the text displayed does not make sense probably because it cannot interpret the .exe file correctly.

I think I have a hit brick wall with this. I think I am trying to make it compatible with windows and maybe that is not the case. Any help with this would be appreciated.


  4. Re: MediaInfo   Reply   Report abuse  
Gianluca Zanferrari - 2012-12-06 14:48:14 - In reply to message 3 from Darren Conyard
i've got it working. I've downloaded the MediaInfo CLI library (no GUI) and putted in a folder on the htdocs

I put here below what I think you have to put attention:

// give here your own video/movie file
// this resides in the folder of the MediaInfo library
$mi = new mediaInfo('C:\xampp\htdocs\web\MediaInfo\sample-053.mkv');

// checks if library works (set your path to library)
$mediainfo = shell_exec('type -P C:\xampp\htdocs\web\MediaInfo\MediaInfo.exe');

// call the library with the filename this way (of course you have to set your path to the library)
$this->media_data = shell_exec("C:\\xampp\\htdocs\\web\\mediainfo\\MediaInfo.exe {$this->filename}");


Filesize: 6.53 MiB
Format: Matroska
Duration: 43s 277ms
Aspect ratio: 2.35:1
Audio format: AAC

Unique ID : 170272730352122199266154378217665899774 (0x801955C33350F2CD83BD27DFFF50ACFE)
Complete name : C:\xampp\htdocs\web\MediaInfo\sample-053.mkv
Format : Matroska
Format version : Version 2
File size : 6.53 MiB
Duration : 43s 277ms
Overall bit rate : 1 266 Kbps
Encoded date : UTC 2010-01-10 08:02:54
Writing application : mkvmerge v2.9.7 ('Tenderness') built on Jul 1 2009 18:43:35
Writing library : libebml v0.7.7 + libmatroska v0.8.1

ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Duration : 43s 280ms
Width : 1 280 pixels
Height : 544 pixels
Display aspect ratio : 2.35:1
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Default : Yes
Forced : No

ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AAC / LC
Codec ID : A_AAC
Duration : 43s 277ms
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 22.05 KHz / 11.025 KHz
Compression mode : Lossy
Delay relative to video : 87ms
Default : Yes
Forced : No

00:00:00.000 : en:00:00:00.211