1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Could not execute FFMPEG inside chrooted nginx

Discussion in 'Server Configuration and Hosting' started by Puntocom, Aug 12, 2015.

  1. Puntocom

    Puntocom Well-Known Member


    I have successfully upgraded to XenForo & XenForo Media Gallery RC2. All works fine except ffmpeg extras.

    Nginx runs chrooted at /var/www. I have installed ffmpeg and I copied /usr/local/bin/ffmpeg to /var/www/bin/ffmpeg, but I get this error when I specify the ffmpeg path at Video Config:

    Could not execute FFMPEG at the path specified: /bin/ffmpeg

    ffmpeg has read and execute permissions for all users.

    Please, can you help me to make it work inside the /var/www chroot? I don't get any Server Error so I don't know how can I debug it.
    Last edited: Aug 12, 2015
  2. Puntocom

    Puntocom Well-Known Member

    I'm sorry, this goes into Server Configuration and Hosting. I have to copy some libraries and archives to the chroot, surely it's not a XFMG problem.
    Last edited: Aug 12, 2015
  3. Set3sh

    Set3sh Active Member


    Please modify the ffmpeg path at Video Config to /var/www/bin/ffmpeg

    And make sure that folder has 0755 permissions.

    Kind regards,
  4. Puntocom

    Puntocom Well-Known Member

    Hello, permissions are 0755. I have tried both /bin/ffmpeg (as should be seen inside the chroot) and /var/www/bin/ffmpeg with no success. Surely it needs some libraries inside the chroot to work.

    I'm not sure if XFMG should send some Server Error to get more info to be able to debug this. I don't see any reference in access/error logs.
  5. Mike

    Mike XenForo Developer Staff Member

  6. Chris D

    Chris D XenForo Developer Staff Member

    That may be worthwhile, but let's see what this shows us first... there's a little hack you could do to get it to show you the output of the command that has been run.

    In the file library/XenGallery/Helper/Video.php look for:
    $this->_ffmpegPathError = new XenForo_Phrase(
    'ffmpegPath' => $ffmpegPath)
    Directly below that add the following:
    throw new XenForo_Exception($outputtrue);
    That might come back with something more useful.

    EDIT: Hopefully Mike's post will lead toward an actual solution, though :)
    Puntocom likes this.
  7. Puntocom

    Puntocom Well-Known Member

    Thanks! I'll try tomorrow in a test server and I'll report how it goes. Now it's too late here and I'm tired.
  8. Puntocom

    Puntocom Well-Known Member

    It worked, I had to run also:

    # mkdir -p /var/www/sbin
    # cp /sbin/ldconfig /var/www/sbin
    # chroot /var/www ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib/
    and then I set ffmpeg's path to /bin/ffmpeg.

    I get this so I'll have to custom compile ffmpeg and hope libvo-aacenc is ported:

    ~~XenForo Media Gallery requires the following encoders to be enabled in FFMPEG: libvo_aacenc~~

    Anyway the problem of this thread is solved :) thank you all.
    Last edited: Aug 13, 2015
  9. Puntocom

    Puntocom Well-Known Member

    Sadly libvo-aacenc is not ported to OpenBSD :(

    Is it really necessary to just generate thumbnails? I only need that feature. Any other way to generate the thumbnails, f.e. from command line?

    I found this: Encode/AAC – FFmpeg

    VisualOn AAC encoding library. Requires ffmpeg configuration with --enable-libvo-aacenc. This has the advantage of not being non-free, and is included by some distributors, but is a rather poor encoder compared to libfdk_aac and even the native FFmpeg AAC encoder according to Quality Assessment of FFmpeg AAC and a mailing list post. This encoder supports up to 2 channels, is CBR only, and does not work with -q:a/-qscale:a.
    Last edited: Aug 13, 2015
  10. Chris D

    Chris D XenForo Developer Staff Member

    Unfortunately using any other encoder is likely to require special options that are either experimental or non-standard, including --enable-nonfree which essentially changes the license to make the libraries and binaries compiled into it, non re-distributable. That would likely restrict people to having to compile it from source manually and the bulk of people won't do that, they'll retrieve it from a redistributable source such as a package repository.

    Could you try reinstalling from one of the static builds available here:
    FFmpeg Static Builds

    It is true that the encoder is not required for thumbnails so we can change that, but I do want to double check the static build above should solve the problem you're having.
  11. Puntocom

    Puntocom Well-Known Member

    I'm running OpenBSD; although it has linux binary compatibility I'm not sure if this will help you confirm that this work due to . I also completely avoid 3rd party binaries, I only trust my OS signed binary packages. Anyway I can try to run it in a Linux laptop when I install it if that's useful for you.

    That would be perfect... that's the only extra feature I need :)
    Last edited: Aug 13, 2015
  12. Chris D

    Chris D XenForo Developer Staff Member

    I'd be interested to hear if it works specifically on OpenBSD. I know generally they work fine.

    It's worth noting that although they are compiled by a 3rd party, they are compiled directly from the FFMPEG source and they are linked to officially from FFMPEG's website:

    Download FFmpeg

    If it's not something you can test on OpenBSD yourself then I can do that easily enough so no problem :)
  13. Puntocom

    Puntocom Well-Known Member

    That would be very nice. Thank you.

    I would gladly test it installing a new VPS but my provider does not support hourly billing yet and I'd have to pay a full month. The extra machine I have runs Libreboot so I can't install OpenBSD there, and it's not possible to run Virtualbox in OpenBSD.
    Chris D likes this.
  14. Chris D

    Chris D XenForo Developer Staff Member

    Ok, no problem :)
    Puntocom likes this.
  15. Puntocom

    Puntocom Well-Known Member

    If you have any issue installing OpenBSD feel free to send me a PC. It's pretty straightforward but it can be a bit tricky.
  16. RoldanLT

    RoldanLT Well-Known Member

    Using Latest XenForo Media Gallery 1.1.0, I didn't install anything relates to ffmpeg.
    I just download the static build, and point it on my admin option, done.
    Video uploads, conversion, transcode, thumbnails works perfect.
    Puntocom likes this.
  17. Chris D

    Chris D XenForo Developer Staff Member

  18. RoldanLT

    RoldanLT Well-Known Member

    CentOS 7.1 @Chris D

    I just download static build, and set this option:
  19. Chris D

    Chris D XenForo Developer Staff Member

    Ah ok, thought you might have been running on OpenBSD too.

    Confident the static builds will work flawlessly for most Linux boxes.
    RoldanLT likes this.
  20. Puntocom

    Puntocom Well-Known Member

    I have tried to execute it as a different user but I need to recompile kernel and OpenBSD support is only for GENERIC kernel.

    I'm going to try this in my local machine since nginx is in chroot with privilege separation.
    Last edited: Aug 13, 2015

Share This Page