> -----Original Message----- > From: mike [mailto:[EMAIL PROTECTED] > Sent: Monday, July 28, 2008 2:17 PM > To: Chris Scott > Cc: php-general@lists.php.net > Subject: Re: FW: [PHP] getting info from video formats > > On 7/28/08, Chris Scott <[EMAIL PROTECTED]> wrote: > > I agree. > > > > I use MPlayer to process videos. One script gets the video length like this. > > > > //use mplayer to pull some info from the video > > $info = exec("\"$mplayer\" $videoPath/$videoName -identify -nosound -frames > > 0 > > $tmpInfoFile"); > > //and open the file it stores the data in > > $infoFile = fopen("$tmpInfoFile", "rb"); > > //then parse for the video length > > while(! feof($infoFile) ) > > { > > $lineBuffer = fgets($infoFile); > > if(preg_match("/ID_LENGTH=/", $lineBuffer)) > > { > > $videoLength = (int) preg_replace("/ID_LENGTH=/", "", > > $lineBuffer); > > } > > } > > you could probably skip piping it to a tempfile - and just use popen() > to open the process...
Yeah thanks. I didn't like the way I was doing it!