Web browsers will play either MP4 or WEBM formatted video files, or both. Thus it is important that both formats be available. In the Divi theme, from Elegant Themes, the video modules ask for both formats. I found that the MP4 format would display properly in the backend as well as in the front end of the website. However, the WEBM version did not appear at either end.
The backend issue is a result of my use of Safari on the Mac. It wants to download webm video rather than play it, so it won’t display on the backend of Divi. If that’s
situation, you’ll have to live with it or come up with a solution.
There are several programs for Mac-OSX including Any Video Converter, Miro Video Converter, EasyHTML5Video and VLC that promise to produce a proper WEBM version of video files. I found that none of them produced a fully functional WEBM file, particularly if the video was shot vertically. Vertical video would get rotated to play back flat and these applications don’t seem to offer an option that will allow the video to retain its original dimensions. I set off on a quest to find something, anything, that world work. This is the result.
Homebrew Package Manager
The first thing I did was install Homebrew. It’s a package manager that helps install applications. Here’s how to install it:
- Open the Terminal application. It is typically in the Utilities Folder within the Applications Folder on your system drive. It willl present a black screen with a prompt. The prompt looks something like: yourcomputer:~ yourname $
- Paste this into Terminal after the prompt:
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
This will download the Homebrew files and install them on your Mac. It will also install some other files like the Xcode Command line system. As the installation proceeds, you will see information on the screen explaining what is happening. At various points, it will ask for your password. That’s the password you use to log into your computer.
When the installation is complete you will see something like this:
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
==> Next steps:
– Run `brew help` to get started
– Further documentation:
ffmpeg is an application that will convert audio and video files from one format to another. We installed Homebrew to make installation of ffmpeg easier. The installation process uses the Terminal application and the Homebrew software we just installed. Get Terminal open and paste the following command there:
brew install libvpx
libvpx is a library that ffmpeg uses. The above command installs it. Next, paste the following command into Terminal:
brew install ffmpeg
This will install ffmpeg and a lot of libraries and other pieces that make it work. Once these steps are complete you can convert file formats.
Making a Conversion
In this example, I’ll be converting an MP4 file to WEBM. Again, the Terminal application is used.
This is the basic command that is needed:
ffmpeg -i source-video.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis destination-video.webm
The catch is that the two ‘video’ files need to be your video. Here’s how to get that going:
Type this (or copy/paste): ffmpeg -i
Then drag your source file to the command line. You will see a lengthy path to the file. Be sure there is a space after it.
Next, type this: -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis
Be sure there is a space at the end of that, then drag your source file to the command line again. Backspace to delete the mp4 suffix on the file and backspace more to rename the file, then be sure the suffix is webm rather than mp4.
When this is all in there correctly it will look something like this:
yourcomputer: ~ yourname $ ffmpeg -i /Volumes/yourvolume/yourfolder/yoursubfolder/yoursourcevideo.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis /yourvolume/yourfolder/yoursubfolder/yourdestinationfile.webm
Hit the return key and ffmpeg will run. Depending upon the size of your source file, it could take awhile. ffmpeg will keep you informed about what’s happening.
Converting WMF to MP4
A similar process can be used to convert a WMF (Windows Meta File) video to an MP4 video:
ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a aac -strict -2 -q:a 100 output.mp4