A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearHow can I obtain the dimensions of a Flash video file from PHP code? - page 1
User InfoPosts
How can I obtain the dimensions of a Flash video file from PHP code?#1
I have an application where users can upload video files of any size, and I'd like to be able to determine the the height/width of a Flash video file (flv or f4v) from a PHP script so that I can size the player appropriately. I'd love a pure PHP solution, but I'd be open to shelling out to a command line tool and parsing the output (if such a tool exists).

Thanks in advance!

posted date: 2008-12-29 16:13:00


Re: How can I obtain the dimensions of a Flash video file from PHP code?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-29 16:13:01


Re: How can I obtain the dimensions of a Flash video file from PHP code?#3
ffmpeg is probably your best bet, there is even a php module of it.ffmpeg -i "FileName"Alternativly you could read the information from the flv file directly by opening the file and reading the meta information.

posted date: 2008-12-29 16:17:00


Re: How can I obtain the dimensions of a Flash video file from PHP code?#4
If you can't use ffmpeg because you don't have control over your server or if you want a PHP solution, have a look at getID3, there's a FLV module that should return a resolution.

posted date: 2008-12-29 19:27:00


Re: How can I obtain the dimensions of a Flash video file from PHP code?#5
Alternatively, Tommy Lacroix seems to have an interesting solution too for reading the metas out of FLV files.

posted date: 2008-12-29 19:41:00


Re: How can I obtain the dimensions of a Flash video file from PHP code?#6
There's also flv4php.If the file's header contains the video's dimensions (which might not always be the case), you can also use the following code:function flvdim($name) { $file = @fopen($name, 'rb'); if($file === false) return false; $header = fread($file, 2048); fclose($file); if($header === false) return false; return array( 'width' => flvdim_get($header, 'width'), 'height' => flvdim_get($header, 'height') );}function flvdim_get($header, $field) { $pos = strpos($header, $field); if($pos === false) return false; $pos += strlen($field) + 2; return flvdim_decode(ord($header[$pos]), ord($header[$pos + 1]));}function flvdim_decode($byte1, $byte2) { $high1 = $byte1 >> 4; $high2 = $byte2 >> 4; $low1 = $byte1 & 0x0f; $mantissa = ($low1 << 4) | $high2; // (1 + m·2^(-8))·2^(h1 + 1) = (2^8 + m)·2^(h1 - 7) return ((256 + $mantissa) << $high1) >> 7;}Pleaso note that the code is reverse engineered from binary files, but it seems to work reasonably well.

posted date: 2009-04-03 03:12:00


Re: How can I obtain the dimensions of a Flash video file from PHP code?#7
I've heard that you can use regular getimagesize() but i haven't tested it. Give it a try.

posted date: 2009-04-03 03:14:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.