toGDImage() broken: Patching ffmpeg-php 0.6.0

Tagged: PHP, Programming, Ubuntu Date: 8th, February 2009

As fallow-up to previous post (link).

After toying with fresh ffmpeg-php 0.6.0 I kept getting error:
Fatal error: failed to convert frame to gd image

Problem lies in broken function _php_avframe_to_gd_image in ffmpeg_frame.c, in the base ffmpeg-php package.
To fix this problem download this patch file and apply it to ffmpeg_frame.c like so:

cd /path/to/ffmpeg-php-0.6.0/
wget http://hazaah.com/download/ffmpeg_frame.c.patch
patch -p0 ffmpeg_frame.c < ffmpeg_frame.c.patch

Reinstall ffmpeg-php && restart apache.

Thats all.

5 Responses to “toGDImage() broken: Patching ffmpeg-php 0.6.0”

  1. Doktor:

    Thanks.

  2. Anne:

    thanks a lot. it’s helpful and you just saved me :)

  3. Martijn:

    Thanks!

    This bug has bitten me several times now. Debian’s ffmpeg-php package has patched it, but Gentoo’s package hasn’t.

    I’m amazed upstream hasn’t released an updated version yet.

  4. Jim Long:

    FFmpeg version SVN-r21080
    ffmpeg-php-0.6.0

    My tests:

    I can make a still using ffmpeg at the command line.
    I can use php gdimage to make an image.
    OK!

    But using ffmpeg-php I can not get an image using this:

    $frame = $movie->getFrame(105); //returns Object id #3
    $im = $frame->toGDImage(); //returns Resource id #4

    Looks like it’s working, but does not produce any image file.

    Advise?

  5. Jim Long:

    Duh..

    I needed to convert the ownership of the videos to apache before it would work.

    Thanks Anyway.

Leave a Reply