You are here: Re: create video screen cap with PHP « PHP Programming Language « IT news, forums, messages
Re: create video screen cap with PHP

Posted by Karl Groves on 08/15/06 14:01

Andy Jeffries <news@andyjeffries.co.uk> wrote in
news:pan.2006.08.15.12.48.50.50049@andyjeffries.co.uk:

> On Sun, 13 Aug 2006 16:44:11 -0500, Karl Groves wrote:
>> Does anyone out there know of a way to capture a frame (at random, if
>> possible) of a movie file with PHP?
>
> The easiest way will be to call out to mplayer to do it. You'll have to
> do it twice, once to get the length of the movie (and then optionally a
> second time if you don't want the first frame).
>
> mplayer -identify -ss 20:00 -vo jpeg -ao null -frames 1 video.avi
>
> This will print out (amongst many many other things):
>
> ID_LENGTH=4498.26
>
> This ID_LENGTH is the the length of the movie in seconds.
>
> Calling mplayer like this will create a file called 000001.jpg which
> you'll need to rename (and implement some locking PHP-side to ensure you
> don't run two mplayer instances simultaneously which will whack the same
> file).
>
> So, along with exec($cmdline, &$output) you have all you need :-)
>


Thanks for the excellent response.
Do you have, perhaps, a more comprehensive example? I don't have much
experience with using exec(), except for using it to perform ImageMagick
commands.



--
Karl Groves
www.karlcore.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация