FFmpeg
FFmpeg is a free command-line program that converts audio and video. JoomVideos runs it on your server to prepare the video files that you and your members upload. Links to YouTube, Vimeo and other sites, streams and embed codes do not need it.
What needs FFmpeg
With Enable Video Processing on in Options > Processing, JoomVideos uses FFmpeg to:
- convert each upload to the MP4, WebM and Ogg sizes you turned on,
- read the duration and the title stored in the file,
- take the thumbnails,
- burn in the watermark, if turned on,
- generate frames, if turned on.
JoomVideos calls only the ffmpeg program. It does not use FFprobe or qt-faststart: MP4 files are written with the "fast start" flag by FFmpeg itself, so they can start playing before they are fully downloaded.
What each job does and how the queue works is explained in Video processing.
What you need
-
FFmpeg on the server, with these encoders:
libx264andaacfor MP4,libvpxandlibvorbisfor WebM,libtheoraandlibvorbisfor Ogg.
Most packaged FFmpeg builds include them. You only need the encoders for the formats you turn on.
-
PHP's
execfunction turned on. JoomVideos starts FFmpeg withexec. -
PHP for the command line (PHP CLI), for the cron job and for Auto Run Type CLI.
Shared hosting
Many shared hosts have no FFmpeg, or turn off exec. Converting video also uses a lot of processor time, and some hosts stop long-running scripts. Ask your host before you rely on it. If FFmpeg is not possible, set Enable Video Processing to No and upload MP4 files that browsers can play, or add videos from YouTube, Vimeo or a direct link instead.
Set up
- Find the full path of FFmpeg on your server. On Linux,
which ffmpegin SSH usually prints it, for example/usr/bin/ffmpeg. Ask your host if you have no SSH access. - Find the full path of PHP's command-line binary, for example
/usr/bin/php. Your host can tell you. - Go to Components > JoomVideos > Options > Server and enter:
- FFmpeg path: the path from step 1. The default is
/usr/local/bin/ffmpeg. On Windows, use the full path offfmpeg.exe, for exampleC:\ffmpeg\bin\ffmpeg.exe. - Php path: the path from step 2. The default is
/usr/local/php, which is wrong on most servers.
- FFmpeg path: the path from step 1. The default is
- Click Save.
- Go to Options > Processing, check that Enable Video Processing is Yes, and turn on the formats and sizes you want.
- Set up a cron job, see below.
Server settings
| Setting | Where | What it does |
|---|---|---|
| FFmpeg path | Options > Server | Full path of the ffmpeg program |
| Php path | Options > Server | Full path of PHP's command-line binary, used to start the CLI script in the background |
| Logging | Options > Server | Saves each FFmpeg command and its output with the job, see below. Off by default |
| Check Requirements | Options > Server | Shows the requirements check on the JoomVideos dashboard. Shown by default |
| Enable Video Processing | Options > Processing | Turns processing on or off. On by default |
| Max Processes | Options > Processing | How many jobs one CLI run handles. 10 by default |
| Cron Task Key | Options > Processing | Secret key for the cron URL |
| Auto Run, Auto Run Type | Options > Processing | Run the queue when pages are opened, see Video processing |
Check that it works
Requirements screen
Go to Components > JoomVideos > Requirements Checker. The FFmpeg row says Yes when JoomVideos could run the program at FFmpeg path and read its version. The screen also shows whether exec is on and PHP's upload limits.
The results are cached. After you change a path, click Recheck.
The command line
Log in with SSH, go to your site's folder and run:
php cli/joomvideos_process.php testcli
It prints CLI Works fine ! when PHP CLI can start Joomla and JoomVideos.
The Test CLI button on the Requirements screen runs the same test from the browser with your Php path. On Linux servers it reports "CLI not working" in JoomVideos 6.1.6 even when the CLI works, so use the SSH test above. On Windows servers the button gives a correct answer.
A test upload
Upload a short video. Then run the queue by hand: go to Components > JoomVideos > Processes and click Process All. Each job should end as Successful, and the converted files appear in Components > JoomVideos > Files.
The cron job
Processing runs in the background. A cron job that runs the queue every few minutes is the way to go on a live site.
CLI cron job (recommended)
Ask your host, or use your hosting panel, to run this every 5 minutes:
*/5 * * * * /usr/bin/php /path/to/your/site/cli/joomvideos_process.php process
Replace /usr/bin/php with your PHP CLI path and /path/to/your/site with the full path of your Joomla site. Each run handles up to Max Processes jobs and prints one line per job.
To run given jobs only, add their IDs (shown in the Processes list):
php cli/joomvideos_process.php process 12 13
URL cron job
If your host only offers URL cron jobs, call:
https://www.example.com/index.php?option=com_joomvideos&task=cron.convert&secretkey=YOUR_KEY
YOUR_KEY is the Cron Task Key in Options > Processing. Every JoomVideos site ships with the same default key, zz4478wxz. Anyone who knows it can start processing on your server, so change it to a long random value before you use this URL.
A URL call runs up to 50 jobs, whatever Max Processes says, and runs inside a normal web request. Large videos can hit your host's time limit there. Prefer the CLI cron job when you can.
Logs
Turn on Logging in Options > Server. After the next run, go to Components > JoomVideos > Processes and click the type of a job to see the FFmpeg command JoomVideos ran and what FFmpeg answered. JoomVideos also writes a text log, administrator/cache/joomvideos.log. Turn logging off again when you are done, as the log keeps growing.
If it does not work
- The FFmpeg row says No. The path is wrong, FFmpeg is not installed, or
execis off. Check the path with your host, save, and click Recheck. - Jobs stay Queued. Nothing runs the queue. Check the cron job, or click Process All to test.
- Jobs end as Failed. A failed job is tried again by the next runs, up to 5 attempts in all. Turn on Logging, select the job in Processes, click Process, and read FFmpeg's answer in the job's log. "Unknown encoder" means your FFmpeg build lacks an encoder from the list above: turn that format off or ask your host for a full build.
- The cron job runs but nothing happens. Run the same command in SSH to see its output. A wrong PHP path, or the PHP of the web server instead of PHP CLI, are the usual causes.
- See also Troubleshooting.