views:

349

answers:

1

Here's the situation. While uploading a video, I want to capture a screenshot of that video and save it as a video thumbnail. I currently can't install ffmpeg on my local machine (it will be installed on the production server of course) so I cannot test the following controller action helper I wrote for this purpose:

<?php
/**
 * FlvThumbnail
 *
 * @author Richard Knop
 */
class My_Controller_Action_Helper_FlvThumbnail extends Zend_Controller_Action_Helper_Abstract
{
    public function direct($flv, $thumbnail) {
        $command = "ffmpeg -v 0 -y -i $flv -vframes 1 -ss 10 -vcodec mjpeg -f rawvideo -s 210x140 -aspect 16:9 $thumbnail";
        return shell_exec($command);
    }

}

$flv is path to the video (this action helper will be executed right after the video is uploaded)

$thumbnail is path where the thumbnail image should be saved

Could anyone please tell me if the above helper will work as I expect? I'm still not sure when will the production server be purchased but I would like to know in advance if this will work.

+1  A: 

works OK for me

dusoft
Thanks for confirmation, that's what I wanted to hear :)
Richard Knop