Skip to content


Como gerar thumbnail de FLV com php

Primeiramente vc deve instalar as Classes no PHP,
ffmpeg (http://ffmpeg.mplayerhq.hu/ffmpeg-export-snapshot.tar.bz2),
ffmpeg_php (http://sourceforge.net/project/showfiles.php?group_id=122353&package_id=133626)

despois dede processo de instalação, simplesmente instanciei o obj,

$movie = new FFmpeg_movie($srcFile, false);

peguei o frame do FLV que eu desejava,

$frame = $movie->getFrame(rand(1, ceil($movie->getFrameRate())));

gerei a imagem GD com,

$frame_thumb = $frame->toGDImage();

e criei o thumbcomo normalmente….

Codigo:

    getFrame(rand(1, ceil($movie->getFrameRate())));
    $frame_thumb = $frame->toGDImage();
    $width = imagesx( $frame_thumb );
    $height = imagesy( $frame_thumb );
    $frame = "";
    $movie = null;
    $thumb = @imagecreatetruecolor( $thumbW, $thumbH );
    @imagecopyresized($thumb, $frame_thumb, 0, 0, 0, 0, $thumbW, $thumbH, $width, $height);
    @imagedestroy($frame_thumb);
    return $thumb;

Posted in Classes, PHP, Servidor.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Bookmarks about Flv linked to this post on 30/08/2008

    [...] – bookmarked by 5 members originally found by agmilmoe on 2008-08-10 Como gerar thumbnail de FLV com php. http://corporacaoweb.com/como-gerar-thumbnail-de-flv-com-php.html – bookmarked by 4 members [...]



Some HTML is OK

or, reply to this post via trackback.