If you’ve recorded a video and wish to include it in a post or comment on the site, if you proceed in the most straightforward way, it’s essentially certain only some people will be able to view it. This is due to the Balkanisation of video formats, which more than two decades after video on the Web became commonplace, remain a swamp of proprietary formats, patent lock-ins and -outs, royalty claims, and attempts by browser vendors to lock in users to their associated mobile devices.
It is possible to navigate this minefield and post videos (almost) everybody can view, but it’s neither easy nor straightforward. This note is written as much as anything as a memo to file so I don’t have to summon the information every time I need to fix a posted video, but if you’re willing to install the required tools and carefully follow the instructions, you can make it work.
But before swimming in the sewer, consider the alternative. If you have a YouTube channel (and you can create one for free), it’s easy to upload your videos there, as “unlisted”, which means people can’t see them unless they know the URL (which is essentially impossible to guess), then simply embed the URL in your post: problem solved. If you don’t want to do that, here we go.
First of all: the basics. When you record a video, it will be encoded in one of a number of video formats, all of which are mutually incompatible. The most common are MP4 used by most Android devices, QuickTime (.mov) used by Apple devices, OGG Video (.ogv) which is generated by tools such as recordMyDesktop and some computer generated animation programs, and WebM which was created by Google as a royalty-free alternative to proprietary formats. Unfortunately, there is no single format which will play on all devices and browsers; for example an Apple QuickTime (.mov) file is unlikely to play on anything other than an Apple platform.
In order to play on all current platforms which can play video, it is necessary to supply video in MP4, Ogg Video, and WebM and let the browser choose one it understands. If you have a video in one of these or another format (for example, QuickTime), it must be “transcoded”, and the Swiss Army Knife for this task is a hideously complicated program called “FFmpeg”, which you can download for free from its official Web site. Reading its complete list of options is to slide into the abyss of despair over the dark side of human technological creativity, but fortunately for the present task we can accept the mostly reasonable defaults and never lift the wet cardboard to see what squirms beneath.
Assuming you’ve installed FFmpeg on your computer, first transfer the video you’ve recorded to your computer however you normally do this. Look at the the file type (extension) and see if it is one of the usable ones: “.mp4”, “.ogv”, or “.webm”. (If it’s “.ogg”, it was probably created by a program that predates distinguishing OGG audio and video: just rename it “.ogv” and proceed.)
Let’s consider the most complicated case, where you have an Apple QuickTime video, for example “myvideo.mov”. From the command line on your computer (Don’t know what that is? You shouldn’t be reading this.) navigate to the directory containing the video and first convert it to OGG Video with:
ffmpeg -i myvideo.mov -b:v 1200k myvideo.ogv
Now convert the OGG file to the other formats with:
ffmpeg -i myvideo.ogv -b:v 1200k myvideo.mp4
ffmpeg -i myvideo.ogv -b:v 1200k myvideo.webm
If you’re starting with an .mp4, first convert that to .ogv and then to .webm. It’s always best to convert directly from your original source to the destination format rather than converting twice, as that loses detail.
Now you should have video files in all of the Web formats, for example:
You should now be able to upload each of these files to the Media Library. Note that Media Library uploads are limited to 32 Mb in size, so if you have a long video, you’ll have to trim it or post in pieces. When uploading videos, just go directly to the New/Media uploader and don’t upload directly within a post.
Now, within your post, include a video “shortcode” specifying the formats and file paths which you can obtain from the Media Library. While editing the post or comment, click the Text tab, and where you want the video to appear, specify the shortcode like:
[video width="480" height="480" ogv="https://www.ratburger.org/wp-content/uploads/2020/08/myvideo.ogv" mp4="https://www.ratburger.org/wp-content/uploads/2020/08/myvideo.mp4" webm="https://www.ratburger.org/wp-content/uploads/2020/08/myvideo.webm"] [/video]
Replace the numbers in the “width” and “height” specifications with those for your video, which you should be able to obtain by playing it locally on your computer. Replace the path names for each of the video formats with that from the Media Library.
If you can’t contemplate this, well be aware that this is the video upload solution provided by WordPress: the self-proclaimed “software that runs more than 35% of the Web”. WordPress: it’s “Worthless, and also free”.