0

While installing FFmpeg-PHP, I got this interesting error:

/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'zim_ffmpeg_movie_getAudioStreamId':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1051:
error: 'CODEC_TYPE_AUDIO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'zim_ffmpeg_movie_getAudioChannels':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1089:
error: 'CODEC_TYPE_AUDIO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'zim_ffmpeg_movie_getAudioSampleRate':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1125:
error: 'CODEC_TYPE_AUDIO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'zim_ffmpeg_movie_getAudioBitRate':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1161:
error: 'CODEC_TYPE_AUDIO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'zim_ffmpeg_movie_getVideoBitRate':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1181:
error: 'CODEC_TYPE_VIDEO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function '_php_read_av_frame':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1204:
error: 'CODEC_TYPE_VIDEO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1215:
warning: implicit declaration of
function 'avcodec_decode_video'
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1219:
error: 'PKT_FLAG_KEY' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function '_php_get_av_frame':
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1246:
error: 'CODEC_TYPE_VIDEO' undeclared
(first use in this function)
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1282:
error: 'AVCodecContext' has no member
named 'hurry_up'
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:1284:
error: 'AVCodecContext' has no member
named 'hurry_up'
/usr/downloads/ffmpeg-php-0.6.0/ffmpeg_movie.c:
In function
'_php_get_sample_aspect_ratio':
/usr/downloads/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

When I ran php -r 'phpinfo();' | grep ffmpeg, I got this:

PHP Warning:  PHP Startup: Unable to
load dynamic library
'/usr/lib/php/modules/ffmpeg.so' -
libavformat.so.52: cannot open shared
object file: No such file or directory
in Unknown on line 0

Any idea how I can fix this? I am running on Centos.

Thanks in advance :)

tundoopani
  • 11
  • 1
  • 5

3 Answers3

1

for this:

PHP Warning:  PHP Startup: Unable to
load dynamic library
'/usr/lib/php/modules/ffmpeg.so' -
libavformat.so.52: cannot open shared
object file: No such file or directory
in Unknown on line 0

With your ffmpeg configure options you will need

--enable-shared

If you are still having issues check the paths:

 export LD_LIBRARY_PATH=/usr/local/lib/
 echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
 ldconfig

Run:

ldconfig

After

make && make install
0

It looks like you're missing the libavformat library. You should be able to install this via the yum package manager.

yum install ffmpeg

If it still doesn't work, try installing the development library

yum install ffmpeg-devel
sreimer
  • 2,218
  • 15
  • 17
  • @sreimer I already have ffmpeg installed. When I ran ffmpeg I got this information (I didn't post it all): "FFmpeg version git-N-29309-gc225615" // "libavcodec 53. 1. 0 / 53. 1. 0" I also tried installing the development library but that didn't work either. The same error appears each time I try to install FFmpeg-php – tundoopani Apr 27 '11 at 05:28
  • According to [this](http://code.google.com/p/pyffmpeg/issues/detail?id=24) not having libavcodec-dev libavformat-dev and libswscale-dev installed will produce a similar error. – sreimer Apr 27 '11 at 13:50
  • @sreimer All of those are installed. Could it possibly be the version of ffmpeg? – tundoopani Apr 28 '11 at 06:55
  • are you compiling from source? – sreimer Apr 28 '11 at 14:11
  • @sreimer I used `git clone git://git.videolan.org/ffmpeg.git`. Is there a better way? – tundoopani Apr 28 '11 at 15:54
  • try using CentOS's package manager `yum` - that way you get something that's been tested and all the dependencies are retrieved automatically – sreimer Apr 28 '11 at 17:03
  • @sreimer Will that install the latest version? Would I have to remove the current ffmpeg before I run `yum install ffmpeg` ? Thanks! – tundoopani Apr 28 '11 at 20:54
  • It may not be the newest but it should be close. You'll have to install to find out. And you should remove the current one first – sreimer Apr 29 '11 at 01:22
  • @sreimer I now get this error: `/usr/downloads/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` – tundoopani Apr 29 '11 at 02:52
  • So you're back to the same error. I would try the [ffmpeg-php group](http://groups.google.com/group/ffmpeg-php?pli=1) for help – sreimer Apr 29 '11 at 14:47
0

Check your system for libavcodec/libavformat, it may just be missing from your library path, or you may have a different version than expected installed.

find / -name 'libavformat*.so*' -print

and see what it comes back with, if you have libavformat.so.53 when your installed ffmpeg is expected .so.52, there is your problem.

Allan Jude
  • 1,286
  • 9
  • 13
  • If so, just create a symlink, for e.g: `ln -s /usr/lib/libavformat.so.53 /usr/lib/libavformat.so.52`. – quanta Oct 27 '11 at 03:43
  • That is not a great idea, it would be better to recompile ffmpeg to link to the proper libraries, although as long as you are going backwards, not forwards, it might work. – Allan Jude Oct 28 '11 at 14:09
  • warning: implicit declaration of function ‘avcodec_init’ – tundoopani Jan 28 '13 at 21:36