SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jan 2008
    Location
    Palm Harbor, FL
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Problems generating thumbnails with ffmpeg-php

    The script below should generate a thumbnail from the middle of the video, however, it instead creates thumbnails from seemingly random frames of the video.

    Furthermore, depending on the video, the following PHP error sometimes occurs:
    "Fatal error: Call to a member function toGDImage() on a non-object..."

    Any ideas?

    PHP Code:
    <?php

    $media 
    = new ffmpeg_movie('video.mp4');
    $frame_count $media->getFrameCount();
    $frame $media->getFrame(round($frame_count 2));
    $thumbnail_image $frame->toGDImage();
            
    header('Content-type: image/jpeg');
    imagejpeg($thumbnail_image);

    ?>

  2. #2
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you installed the extension of ffmpeg in your server ?

  3. #3
    SitePoint Addict
    Join Date
    Jan 2008
    Location
    Palm Harbor, FL
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PHPycho View Post
    Have you installed the extension of ffmpeg in your server ?
    Of course. The script often succeeds at producing a thumbnail, but the thumbnail is not from the half-way point of the video from which it should be. When the script does not succeed, it produces the fatal error I mentioned in my initial post.

    For now I think I will execute ffmpeg directly to generate thumbnails.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •