Strange issue with toGDImage()

314 views
Skip to first unread message

mape

unread,
Aug 3, 2006, 8:49:35 PM8/3/06
to ffmpeg-php
I have a FreeBSD 6.1-RELEASE (GENERIC)

phpinfo() shows:
GD Support enabled
GD Version bundled (2.0.28 compatible) i.e. compiled with "--with-gd"

ffmpeg-php version 0.4.7
libavcodec version Lavc51.10.0
libavformat version Lavf50.5.0

I can run all PHP commands without any errors. I can use all GD
commands without any errors. I can use most of the ffmpeg-php commands.
But when I run:

$mov = new ffmpeg_movie('test.avi');
$ff_frame = $mov->getFrame(30);
if ($ff_frame) {
$gd_image = $ff_frame->toGDImage();
if ($gd_image) {
imagejpg($gd_image);
imagedestroy($gd_image);
}
}
i get "Fatal error: Call to undefined method ffmpeg_frame::toGDImage()"

Anyone know how to fix this issue? Its rather frustrating as my senior
project in school depends on me getting this working as soon as
possible.

Yours
mape

Todd Kirby

unread,
Aug 3, 2006, 9:03:35 PM8/3/06
to ffmpe...@googlegroups.com
Probably the configure script failed to detect that gd was installed. Under troubleshooting in the install guide there is some vague mention of how to fix it that boils down to...

change the line...

   //#define HAVE_LIBGD20

   ...to...

   #define HAVE_LIBGD20

   ...in ffmpeg_frame.h and run...

   make clean && make

   ...to force ffmpeg to recompile with gd support.


I need to add a configure option to allow to force compilation of the gd stuff.

-Todd

mape

unread,
Aug 3, 2006, 9:23:18 PM8/3/06
to ffmpeg-php
Changed from //#define HAVE_LIBGD20 to #define HAVE_LIBGD20 and redid
the procedure. Doesn't seem to do anything. Still getting Fatal error:

Call to undefined method ffmpeg_frame::toGDImage()

#######################################################

[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025
[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# ./configure &&
make
checking for egrep... grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... yes
checking build system type... i386-unknown-freebsd6.1
checking host system type... i386-unknown-freebsd6.1
checking target system type... i386-unknown-freebsd6.1
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
checking for PHP extension directory... /usr/local/lib/php/20050922
checking for PHP installed headers prefix... /usr/local/include/php
checking for re2c... no
configure: WARNING: You will need re2c 0.9.11 or later if you want to
regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for ffmpeg support... yes, shared
checking for ffmpeg headers... ...found in /usr/local/include/ffmpeg
checking for ffmpeg libavcodec.so... ...found in /usr/local/lib
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared
libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... freebsd6.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared
libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared
libraries... yes
checking dynamic linker characteristics... freebsd6.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
/usr/local/bin/bash /usr/home/mape/php-5.1.4/ext/ffmpeg-php/libtool
--mode=install cp ./ffmpeg.la
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/modules
cp ./.libs/ffmpeg.so
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/modules/ffmpeg.so
cp ./.libs/ffmpeg.lai
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/modules/ffmpeg.la
libtool: install: warning: remember to run `libtool --finish
/home/mape/php-5.1.4/ext/ffmpeg-php/modules'

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam)
[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# make install
Installing shared extensions: /usr/local/lib/php/20050922/

[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]#
/usr/local/etc/rc.d/apache22.sh restart
Performing sanity check on apache22 configuration:
Syntax OK
Stopping apache22.
Waiting for PIDS: 6669.
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

Todd Kirby

unread,
Aug 3, 2006, 10:51:15 PM8/3/06
to ffmpe...@googlegroups.com
did you 'make clean' first?

On 8/3/06, mape <katapults...@gmail.com> wrote:

Changed from //#define HAVE_LIBGD20 to #define HAVE_LIBGD20 and redid
the procedure. Doesn't seem to do anything. Still getting Fatal error:
Call to undefined method ffmpeg_frame::toGDImage()

#######################################################

[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
[root@head /usr/home/mape/php- 5.1.4/ext/ffmpeg-php]# ./configure &&
checking for string.h.. . yes
checking if g++ supports -c -o file.o.. . yes

mape

unread,
Aug 3, 2006, 10:56:30 PM8/3/06
to ffmpeg-php
That I didn't do.. But now I get an error at 'make install'

[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# make clean
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp5.la modules/* libs/*


[root@head /usr/home/mape/php-5.1.4/ext/ffmpeg-php]# make install

/usr/local/bin/bash /usr/home/mape/php-5.1.4/ext/ffmpeg-php/libtool
--mode=compile gcc -I. -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php
-DPHP_ATOM_INC -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/include
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/main
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
-I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall
-fno-strict-aliasing -c
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg.c -o ffmpeg.lo
mkdir .libs
gcc -I. -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -DPHP_ATOM_INC
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/include
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/main
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
-I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall
-fno-strict-aliasing -c
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg.c -fPIC -DPIC -o
.libs/ffmpeg.o
/usr/local/bin/bash /usr/home/mape/php-5.1.4/ext/ffmpeg-php/libtool
--mode=compile gcc -I. -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php
-DPHP_ATOM_INC -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/include
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/main
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
-I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall
-fno-strict-aliasing -c
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_movie.c -o
ffmpeg_movie.lo
gcc -I. -I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -DPHP_ATOM_INC
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/include
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php/main
-I/usr/home/mape/php-5.1.4/ext/ffmpeg-php -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
-I/usr/local/include/ffmpeg -DHAVE_CONFIG_H -g -O2 -Wall
-fno-strict-aliasing -c
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_movie.c -fPIC -DPIC -o
.libs/ffmpeg_movie.o
In file included from
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_movie.c:8:
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_frame.h:10:1: warning:
"HAVE_LIBGD20" redefined
In file included from /usr/local/include/php/TSRM/tsrm_config.h:1,
from
/usr/local/include/php/TSRM/tsrm_config_common.h:11,
from
/usr/local/include/php/TSRM/tsrm_virtual_cwd.h:26,
from /usr/local/include/php/main/php.h:404,
from
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_movie.c:1:
/usr/local/include/php/main/../main/php_config.h:1574:1: warning: this
is the location of the previous definition
In file included from
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_movie.c:8:
/usr/home/mape/php-5.1.4/ext/ffmpeg-php/ffmpeg_frame.h:20:17: #if with
no expression
*** Error code 1

mape

unread,
Aug 3, 2006, 11:05:13 PM8/3/06
to ffmpeg-php
Nevermind. I got it working after I made a plain install after the php
compile with -gd as a parameter. Thanks for the help :)

Todd Kirby

unread,
Aug 3, 2006, 11:11:35 PM8/3/06
to ffmpe...@googlegroups.com
ok, that means the problem wasn't with HAVE_LIBGD20 not getting set. You can comment HAVE_LIBGD20 out in ffmpeg_frame.h again and recompile.

Once you have it working again, run the test script test_ffmpeg.php and send me the output.

-Todd

On 8/3/06, mape <katapults...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages