FW: FW: [PHP] getting info from video formats

From: Date: Mon, 28 Jul 2008 18:42:19 +0000
Subject: FW: FW: [PHP] getting info from video formats
Groups: php.general 
Request: Send a blank email to php-general+get-277403@lists.php.net to get a copy of this message
> -----Original Message----- > From: mike [mailto:mike503@gmail.com] > 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 <Chris.Scott@nstein.com> 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!

« previous php.general (#277403) next »