views:

199

answers:

2

I am working on a videos sharing web site and I want to take screen shot from a flv video file from a another website like youtube. I am using PHP but i have no idea how to do it. any guidance is appreciated.

+2  A: 

You can download the flv video on to your server (there are many many apps and documentation on getting the flv from YouTube) and then use a command line tool to extract a screenshot from the video (i.e. similar to this blog entry).

I don't know any tool that would allow you to do this without downloading the video. While it is technically possible, you'd probably have to go outside PHP and adapt an open source tool for your needs. This site might be a good starting point for such a solution.

michaelk
+4  A: 

There seems to be ffmpeg extension for PHP.

By quickly looking it, something like this should work:

$movie = new ffmpeg_movie('foo.flv');
$frame = $movie->getFrame(1234);
imagefromjpeg($frame, 'foo.jpeg');
imagedestroy($frame);

Of course this means that this extensions has to be added to current PHP installation.

raspi