ASF structure

The place for "I can't figure out how to..." questions.
Post Reply
SocialistCoder
User
Posts: 2
Joined: Thu Jun 29, 2006 7:02 pm

ASF structure

Post by SocialistCoder » Thu Jun 29, 2006 7:57 pm

Hi,

when using this very simple script everything works perfectly except with ASF movies.

Code: Select all

$getID3 = new getID3;
$fileinfo = $getID3->analyze($pathToFile);

$videoWidth = $fileinfo['video']['resolution_x'];

...
I've looked at the ['video'] substructure returned by getID3 for a ASF file and it is different than all the other movie format.
To get the dimension of a ASF movie, instead of using the usual $fileinfo['video']['resolution_x'] I have to use $fileinfo['video']['streams'][$i]['resolution_x'] (where $i = the stream index).

Is this a normal behavior ?

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

Post by James Heinrich » Sun Jul 02, 2006 12:55 pm

Examining the value of [video][streams][$i] (same with audio streams) is always the more-correct method, especially for streaming formats like ASF or Real where multiple video streams are very likely. In such cases, the base values like [video][bitrate] will show the sum of all video stream bitrates, whereas the bitrate of only one particular stream (probably either the highest or lowest value) is likely of interest to most users.

However, I agree that having [resolution_?] in the root of [video] would be useful. Add this code on line 1363 of module.audio-video.asf.php:

Code: Select all

if (!empty($thisfile_video['streams'])) {
	$thisfile_video['streams']['resolution_x'] = 0;
	$thisfile_video['streams']['resolution_y'] = 0;
	foreach ($thisfile_video['streams'] as $key => $valuearray) {
		if (($valuearray['resolution_x'] > $thisfile_video['streams']['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['streams']['resolution_y'])) {
			$thisfile_video['resolution_x'] = $valuearray['resolution_x'];
			$thisfile_video['resolution_y'] = $valuearray['resolution_y'];
		}
	}
}

SocialistCoder
User
Posts: 2
Joined: Thu Jun 29, 2006 7:02 pm

Post by SocialistCoder » Mon Jul 03, 2006 5:17 am

Ahhh I see!
Thanks for the help James. :)

Post Reply