mp4 and ogg|ogv resolution

Locked
togo
User
Posts: 8
Joined: Sun Mar 20, 2011 11:03 am
Are you a spambot?: no
Location: Waltrop, NRW, Germany

mp4 and ogg|ogv resolution

Post by togo » Sun Mar 20, 2011 11:10 am

Hi @ all,

i use getID3 for reading the resolution of diffrent video formats.

Now i see, getID3 don't read the resolution of mp4 and ogg or ogv files.

Does anybody knows an other solution for this problem?

thx
Tom

James Heinrich
getID3() v1 developer
Posts: 1462
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: mp4 and ogg|ogv resolution

Post by James Heinrich » Sun Mar 20, 2011 11:32 am

A sample file would be a good start. Please post or PM me a link to a sample file I can take a look at.

togo
User
Posts: 8
Joined: Sun Mar 20, 2011 11:03 am
Are you a spambot?: no
Location: Waltrop, NRW, Germany

Re: mp4 and ogg|ogv resolution

Post by togo » Sun Mar 20, 2011 9:13 pm

Hallo James,

you can download the sample files from
http://lab.joomfx.de/TestFiles2/big_buck_bunny.mp4
and
http://lab.joomfx.de/TestFiles2/big_buck_bunny.ogv

The result of the follow script

Code: Select all

<?php

require_once('./getid3/getid3.php');

// Initialize getID3 engine

$getID3 = new getID3;
$DirectoryToScan = './TestFiles2/';
$dir = opendir($DirectoryToScan);
while (($file = readdir($dir)) !== false) {
	$FullFileName = realpath($DirectoryToScan.'/'.$file);
	if (is_file($FullFileName)) {
		set_time_limit(30);

		$ThisFileInfo = $getID3->analyze($FullFileName);

		getid3_lib::CopyTagsToComments($ThisFileInfo);
		
		
		// output desired information in whatever format you want
		echo 'version: '.$getID3->info['GETID3_VERSION'].'<br />';
		echo 'File: '.$ThisFileInfo['filenamepath'].'<br />';
		echo 'Artist: '.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<br />', $ThisFileInfo['comments_html']['artist']) : '&nbsp;').'<br />';
		echo 'Title: '.(!empty($ThisFileInfo['comments_html']['title'])  ? implode('<br />', $ThisFileInfo['comments_html']['title'])  : '&nbsp;').'<br />';
		echo 'BitRate: '.(!empty($ThisFileInfo['audio']['bitrate'])        ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps'   : '&nbsp;').'<br />';
		echo 'Playtime: '.(!empty($ThisFileInfo['playtime_string'])         ? $ThisFileInfo['playtime_string']                          : '&nbsp;').'<br />';
		
		if(!empty($ThisFileInfo['video']['resolution_x']) || !empty($ThisFileInfo['video']['resolution_y'])){
			$res_x=$ThisFileInfo['video']['resolution_x'];
			$res_y=$ThisFileInfo['video']['resolution_y']; 
		} else{
			$res_x='undefined';
			$res_y='undefined'; 
		}

		echo 'Resolution: '.$res_x.' x '.$res_y.'<br />';
		echo '<pre>';
		print_r($ThisFileInfo['video']);
		echo '</pre>';
		echo '<hr />';
	}
}
is here
http://lab.joomfx.de/video.sample.php

thx for your help.

Tom

James Heinrich
getID3() v1 developer
Posts: 1462
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: mp4 and ogg|ogv resolution

Post by James Heinrich » Sun Mar 20, 2011 11:14 pm

I've made the current development code at least recognize that as an ogg-theora video, but as of yet it still does not return any useful information (resolution, playtime, bitrate... nothing). But I'm working on that :)

togo
User
Posts: 8
Joined: Sun Mar 20, 2011 11:03 am
Are you a spambot?: no
Location: Waltrop, NRW, Germany

Re: mp4 and ogg|ogv resolution

Post by togo » Mon Mar 21, 2011 6:37 am

And how it looks with the resolution of mp4 video files?

OK. Find the solution. The video file is saved as audio file, after convert it to an video file the resolution can displayed.

Locked