Exemple #1
0
function createVideoIcon($file)
{
    // @todo: Add support for video thumbnail create.
    // @see: http://stackoverflow.com/questions/14662027/generate-thumbnail-for-a-bunch-of-mp4-video-in-a-folder
    //return giftThumbnail();
    /* should install ffmpeg for the method to work successfully  */
    if (checkFFMPEG()) {
        //generate thumbnail
        $preview = sys_get_temp_dir() . '/' . md5($file) . '.jpg';
        @unlink($preview);
        //capture video preview
        $command = "ffmpeg -i \"" . $file . "\" -f image2 -vframes 1 \"" . $preview . "\"";
        exec($command);
        // Parsear la imagen
        //TODO: Make it work using libGD (see createIcon())
        return createIconGD($preview);
    } else {
        //fallback
        return giftThumbnail();
    }
}
function createVideoIcon($file)
{
    /* should install ffmpeg for the method to work successfully  */
    if (checkFFMPEG()) {
        //generate thumbnail
        $preview = sys_get_temp_dir() . '/' . md5($file) . '.jpg';
        @unlink($preview);
        //capture video preview
        $command = "ffmpeg -i \"" . $file . "\" -f mjpeg -ss 00:00:01 -vframes 1 \"" . $preview . "\"";
        exec($command);
        return createIconGD($preview);
    } else {
        return base64_decode(videoThumbnail());
    }
}