Search code examples
phpffmpegamazon-elastic-beanstalk

Installing ffmpeg on elastic beanstalk


I am trying to install ffmpeg to elastic beanstalk, I have created config file with below commands-

packages:
  yum:
    ImageMagick: []
    ImageMagick-devel: []
commands:
  01-wget:
    command: "wget -O /tmp/ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz"
  02-mkdir:
    command: "if [ ! -d /opt/ffmpeg ] ; then mkdir -p /opt/ffmpeg; fi"
  02-tar:
    command: "tar xvf /tmp/ffmpeg.tar.xz -C /opt/ffmpeg"
  04-ln:
    command: "if [[ ! -f /usr/bin/ffmpeg ]] ; then ln -sf /opt/ffmpeg/ffmpeg-3.4-64bit-static/ffmpeg /usr/bin/ffmpeg; fi"
  05-ln:
    command: "if [[ ! -f /usr/bin/ffprobe ]] ; then ln -sf /opt/ffmpeg/ffmpeg-3.4-64bit-static/ffprobe /usr/bin/ffprobe; fi"
  06-pecl:
    command: "if [ `pecl list | grep imagick` ] ; then pecl install -f imagick; fi"

Till 05-ln everything seems to be fine, but on 06-pecl I am getting below error-

[2018-03-08T08:06:29.390Z] INFO  [32014] - [Application update app-f8f2d-180308_133451@78/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_FranchiseSoft/Command 06-pecl] : Completed activity. Result:
  PHP Warning:  Module 'imap' already loaded in Unknown on line 0
  /bin/sh: line 0: [: 3.1.2: binary operator expected

Solution

  • Nevermind, 04-ln and 05-ln were actually wrong, fixed it by-

      04-ln:
        command: "if [[ ! -f /usr/bin/ffmpeg ]] ; then ln -sf /opt/ffmpeg/ffmpeg-3.4.2-64bit-static/ffmpeg /usr/bin/ffmpeg; fi"
      05-ln:
        command: "if [[ ! -f /usr/bin/ffprobe ]] ; then ln -sf /opt/ffmpeg/ffmpeg-3.4.2-64bit-static/ffprobe /usr/bin/ffprobe; fi"