Re: FW: [PHP] getting info from video formats
| From: | mike | Date: | Mon, 28 Jul 2008 18:17:21 +0000 |
| Subject: | Re: FW: [PHP] getting info from video formats | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277401@lists.php.net to get a copy of this message | ||
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...