Search code examples
phpapacheffmpeg-php

What filepath to use with ffmpeg_php?


I'm using ffmpeg-php to extract thumbnails from user uploaded videos for a site I'm building. Previously the videos were stored in a subdirectory of the directory containing the relevant php files and it worked fine. However I have now altered my directory structure and can't work out what filepath to supply ffmpeg_movie() with. The relevant files are:

  • /app/classes/class_lib.php
    • location of the class that calls ffmpeg_movie() and extracts/saves the thumbnail.
  • /app/upload.php
    • the php file that requires the above class, instantiates it and calls the relevant method.

And the videos are stored in:

  • /videos/encodes/

All those paths are relative to the sites public root (public_html). I have trieda number of different paths but keep getting a "cannot open movie file [Attempted video path]". I've tried paths relative to the site root /video/encodes/movie.mp4, relative to the executed php file ../video/encodes/movie.mp4, relative to the php class file ../../video/encodes/movie.mp4 and even the server root /srv/www/sitename.com/public_html/video/encodes/movie.mp4. No luck with any of them.

Any other ideas?

Server is Apache running on Ubuntu and directory permissions haven't changed since it was previously working (the encodes folder is globally readable)


Solution

  • I've ended up using the full url http://somesite.com/video/encodes/movie.mp4. It actually works, but it feels like the wrong way to do it. Unfortunately nothing else seems to work.

    Still, if you're having the same problem then this is at least a working solution.