Hello everyone, I need to check if a file is divx format using php, most definaty using curl. i did make a function before to check file format just from the extension but i cannot trust that. is there anyway to check if a file is divx format using php without wasting many bandwidth if so please help me out here.
I can point to a PERL script, which is part of the DivFix. Maybe that will help a little. http://divfix.maxeline.com/divfix.html
Hey! Can you please send me any 1 file in divx format, and I will try to help you out into this problem. If the headers are formatted properly, we should be able to make out from them. Thanks imphp
i dont want to look like im bumping a thread but i have been waiting for 2 days for help and this is what i get
You could have done some research into this. it's not hard. First thing you need to do is find out where in an avi header the divx code is stored...a quick google tells us its called a FOURCC code and that it is found in the format vidsXXXX where XXXX is the code it's not rocket science from there to figure out how to use that information i hope
I have done alot of research into this, if i check the video headers all i get is Content-Type: video/x-msvideo and i checked the file formats, however i think x msvideo is used in other formats? i searched into that and couldnt find an answer i came here so someone could help i dont understand what your saying about fourcc code
Read in the first 1000 characters say of the actual video. In there there will be 8 characters that correspond to vidsDIVX for a divx video. The file that you gave above has vidsDIVX in the first 128 bytes
this is a part of what i used to create something else but i was thinking it might help with this one: curl_setopt($emre, CURLOPT_HEADER, 1); // get the header curl_setopt($emre, CURLOPT_NOBODY, 1); // and *only* get the header curl_setopt($emre, CURLOPT_RETURNTRANSFER, 1); curl_setopt($emre, CURLOPT_TIMEOUT, 20); curl_setopt($emre, CURLOPT_URL, $divxfile); PHP:
Well this code works fine... $f = fopen('http://www.jhepple.com/support/SampleMovies/AVI_DivX.avi','r') or die('UNABLE TO OPEN STREAM'); $contents = fgets($f,1024); $pattern = '/vids(\w{4})/'; preg_match($pattern,$contents,$found); echo $found[1]; PHP: Obviously you will need to tweak it somewhat for whatever you need, but you see the basics of what it is meant to do