FW: [PHP] getting info from video formats
| From: | Chris Scott | Date: | Mon, 28 Jul 2008 17:50:33 +0000 |
| Subject: | FW: [PHP] getting info from video formats | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-277400@lists.php.net to get a copy of this message | ||
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);
}
}
> -----Original Message-----
> From: mike [mailto:mike503@gmail.com]
> Sent: Monday, July 28, 2008 1:12 PM
> To: Rene Veerman
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] getting info from video formats
>
> On 7/28/08, Rene Veerman <rene7705@gmail.com> wrote:
>
> > ImageMagick's "identify" command supposedly reads AVI and MPEG, but i
> > can't
> > get it to work on my avi's:
>
> i wouldn't rely on it; i'd rely on it for "Image"s :)
>
> > C:\Users\rene\Documents\Downloads>identify
> > Stargate.Atlantis.S05E02.HDTV.XviD-0TV.avi
> > identify: Not enough pixel data
> > `Stargate.Atlantis.S05E02.HDTV.XviD-0TV.avi'.
>
> you naughty pirater :P
>
> > So if ImageMagick isn't the tool to use for video files, i wonder if there
> > is any other tool that i can use to determine the size of video files.
> >
> > I'd like to be able to read as many of the major video formats (AVI, XVID,
> > DIVX, QT, etc) as possible.
>
> ffmpeg is probably the best bet. i believe it has an option to get
> video info and not try to process it.
>
> also look at the mencoder/mplayer suite of tools.
>
> maybe even transcode.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php