Kroko Just another WordPress weblog

April 17, 2011

solve ffmpeg-php gd issue

Filed under: Uncategorized — admin @ 9:09 pm

gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wno-deprecated-declarations -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -fPIC -DPIC -o .libs/ffmpeg_movie.o
/bin/sh /usr/local/src/ffmpeg-php-0.6.0/libtool –mode=compile gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wno-deprecated-declarations -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -o ffmpeg_frame.lo
gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wno-deprecated-declarations -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1

I got to this using Google. We had this issue on CentOS but its the same error so I’m pretty sure it will solve your issues as well —

With the latest version of ffmpeg-php (0.6.0), update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

then it compiled fine.

For those who don’t know how to do this –

vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:w
:q!
./configure
make
make install

add extension=”ffmpeg.so” inside php.ini .

2 Comments »

  1. I get the following, even after following your fix

    /bin/sh /usr/local/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
    mkdir .libs
    cc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: ‘avcodec_init’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3851)
    /bin/sh /usr/local/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -o ffmpeg_movie.lo
    cc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -fPIC -DPIC -o .libs/ffmpeg_movie.o
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:73: error: ‘MAX_STREAMS’ undeclared here (not in a function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_video_stream’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:152: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:152: error: (Each undeclared identifier is reported only once
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:152: error: for each function it appears in.)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_audio_stream’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:165: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_open_movie_file’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:258: warning: ‘av_open_input_file’ is deprecated (declared at /usr/include/libavformat/avformat.h:1433)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:263: warning: ‘av_find_stream_info’ is deprecated (declared at /usr/include/libavformat/avformat.h:1476)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_decoder_context’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:484: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:513: warning: ‘avcodec_open’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4073)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getComment’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:531: error: ‘AVFormatContext’ has no member named ‘comment’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:531: error: ‘AVFormatContext’ has no member named ‘comment’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getTitle’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:546: error: ‘AVFormatContext’ has no member named ‘title’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:546: error: ‘AVFormatContext’ has no member named ‘title’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAuthor’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:561: error: ‘AVFormatContext’ has no member named ‘author’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:561: error: ‘AVFormatContext’ has no member named ‘author’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getCopyright’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:575: error: ‘AVFormatContext’ has no member named ‘copyright’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:575: error: ‘AVFormatContext’ has no member named ‘copyright’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAlbum’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:590: error: ‘AVFormatContext’ has no member named ‘album’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:590: error: ‘AVFormatContext’ has no member named ‘album’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getGenre’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:604: error: ‘AVFormatContext’ has no member named ‘genre’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:604: error: ‘AVFormatContext’ has no member named ‘genre’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getTrackNumber’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:619: error: ‘AVFormatContext’ has no member named ‘track’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getYear’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:632: error: ‘AVFormatContext’ has no member named ‘year’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_framerate’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:678: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_framenumber’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:810: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_pixelformat’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:850: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getPixelFormat’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:868: warning: ‘avcodec_get_pix_fmt_name’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3694)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_codec_name’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:963: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getVideoCodec’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:989: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAudioCodec’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1009: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getVideoStreamId’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1029: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAudioStreamId’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1051: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAudioChannels’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1089: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAudioSampleRate’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1125: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getAudioBitRate’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1161: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘zim_ffmpeg_movie_getVideoBitRate’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1181: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_read_av_frame’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1204: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1215: warning: implicit declaration of function ‘avcodec_decode_video’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1219: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_av_frame’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1246: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1282: error: ‘AVCodecContext’ has no member named ‘hurry_up’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1284: error: ‘AVCodecContext’ has no member named ‘hurry_up’
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_get_sample_aspect_ratio’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1443: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
    make: *** [ffmpeg_movie.lo] Error 1

    Comment by aanimator — January 23, 2012 @ 6:51 pm

  2. what ffmpeg version do you have? if you have 0.8 try to downgrade to 0.7.1.
    i’m using: FFmpeg version 0.6.1

    Comment by Kroko — January 24, 2012 @ 10:54 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress