NetBSD-friendly Web Videos

Watching videos online has become very popular in recent years. Large video web sites as Youtube or Netflix are responsible for a lot of the Internet traffic these days. The predominant technology for delivering video over the Internet is still Adobe Flash. Unfortunately the Flash Player isn’t only renown for its poor security record and adverse effects on browser performance it is also available for only a small number of platforms (Windows, Mac OS X and a few Linux platforms). There are other browser video plugins like Microsoft’s Silverlight and RealPlayer. But they are available for even less platforms and not widely deployed.

Of the above video solutions only Flash works under NetBSD’s amd64 and i386 ports, but often not very well. While NetBSD 6.0 should improve that situation with the updated Linux emulation Flash will still be limited to the x86 ports. So how can you create a web page with an embedded video that is NetBSD-friendly despite all these technology problems?

Fortunately the new upcoming HTML5 standard can help here. Although it is still under development a lot of its aspects are already supported by modern browsers. One of them is the video element. It allows to embed a video into a web page with only a few lines of HTML code. Here is a simple example for a video element:

<video height="320" width="240">
<source src="my-video.ogv" type="video/ogg" />
</video>

This allows video playback in e.g. Firefox under NetBSD without any extra plugins. There is however one small problem: there is no single video file format that is supported by all browsers. Safari, Internet Explorer 9 and most mobile browsers only support MP4 files. Firefox and Opera however only support OGV files. Only Google Chrome supports both video file formats.

Fortunately the HTML5 video element allows you to specify multiple different video file format. Here is an improved version of our example:

<video height="320" width="240">
<source src="my-video.ogv" type="video/ogg" />
<source src="my-video.mp4" type="video/mp4" />
</video>

In this case the browser can pick either the MP4 or the OGV video file. There are various programs for creating video files in MP4 or OGV format. If you are lucky your video editing software will already support generating MP4 files. If it doesn’t you can try the ffmpeg program to convert the video file into an MP4 file. Although ffmpeg can generate OGV files as well I would recommend ffmpeg2theora for this job. It can read the same file formats and generates OGV files whose audio information is correctly played back by Firefox.

If you create a web page with video using the above recipe it will work on a large number of platforms. Playback of this video has been tested with Firefox (NetBSD, Mac OS X, Linux, Windows), Safari (Mac O X), Internet Explorer 9 (Windows), Opera (Linux) an HTC Desire Z under Android 2.3.3, an iPhone 4 and an iPad. Only an iPhone 3GS refused to play the video simply because the video’s resolution isn’t supported on that hardware.

This entry was posted in NetBSD. Bookmark the permalink.