Author Archives: Multimedia Mike

On WebP and Academic Exercises

Yesterday, Google released a new still image format called WebP. To those skilled in the art, this new format will be recognizable as a single VP8 golden frame with a 20-byte header slapped on the front (and maybe a little metadata thrown in for good measure). We have a MultimediaWiki page and a sample ready to go.

Further, I submitted a patch to ffmpeg-devel for FFmpeg’s img2 handling system to decode these files. FFmpeg should support processing these files soon… if anyone cares. This leads into…

The Point, or Lack Thereof
Since yesterday’s release, I have read a whirlwind of commentary about this format, much of it critical and of the “what’s the point?” variety. For my part, I can respect academic exercises, a.k.a., just trying random stuff to see if you can make it work. That’s pretty much this blog’s entire raison d’être. But WebP transcends mere academic exercise; Google seems to be trying to push it as a new web standard. I don’t see how the format can go anywhere based on criticisms raised elsewhere — e.g., see Dark Shikari’s thoughtful write-up — which basically boil down to WebP not solving any real problems, technical, legal, or otherwise.

How did WebP come to be? I strongly suspect some engineers noticed that JPEG is roughly the same as an MPEG-1 intraframe, so why not create a new still frame format based on VP8 intraframes? Again, I can respect that thinking– I have pondered how a still image format would perform if based on VP3/Theora or Sorenson Video 1.

Technically
Google claims a significant size savings for WebP vs. standard JPEG. Assuming that’s true (and there will be no shortage of blog posts to the contrary), it will still be some time before WebP support will find its way into the majority of the web browser population.

But this got me thinking about possible interim solutions. A website could store images compressed in both formats if it so chose. Then it could serve up a WebM image if the browser could support it, as indicated by the ‘Accept’ header in the HTTP request. It seems that a website might have to reference a generic image name such as <img src="some-picture.image">; the web server would have to recognize the .image extension and map it to either a .jpg or a .webp image depending on what the browser claims it is capable of displaying.

Leftovers
I appreciate that Dark Shikari has once again stuck his neck out and made a valiant — though often futile — effort to educate the internet’s masses. I long ago resigned myself to the fact that many people aren’t going to understand many of the most basic issues surrounding multimedia technology (i.e., moving pictures synchronized with audio). But apparently, this extends to still image formats as well. It was simultaneously humorous and disheartening to see commenters who don’t even understand the application of, e.g., PNG vs. JPEG: Ahem, “We already have a great replacement for jpg: .PNG”. Coupled with the typical accusations of MPEG tribalism, I remain impressed D. Shikari finds the will to bother.

Still, I appreciate that the discussion has introduced me to some new image formats of which I was previously unaware, such as PGF and JPEG XR.

Dreamcast Operating Systems

The Sega Dreamcast was famously emblazoned with a logo proudly announcing that it was compatible with Windows CE:



It’s quite confusing. The console certainly doesn’t boot into some version of Windows to launch games. Apparently, there was a special version of CE developed for the DC and game companies had the option to leverage it. I do recall that some game startup screens would similarly advertise Windows CE.

Once the homebrew community got ahold of the device, the sky was the limit. I think NetBSD was the first alternative OS to support the Dreamcast. Meanwhile, I have recollections of DC Linux and LinuxDC projects along with more generic Linux-SH and SH-Linux projects.



DC Evolution hosts a disc image available for download with an unofficial version of DC Linux, assembled by one Adrian O’Grady. I figured out how to burn the disc (burning DC discs is a blog post of its own) and got it working in the console.

It’s possible to log in directly via the physical keyboard or through a serial terminal provided that you have a coder’s cable. That reminds me– my local Fry’s had a selection of USB-to-serial cables. I think this is another area that is sufficiently commoditized that just about any cable ought to work with Linux out of the box. Or maybe I’m just extrapolating from the experience of having the cheapest cable in the selection (made by io connect) plug and play with Linux.



Look! No messy converter box in the middle as in the Belkin case. The reason I went with this cable is that the packaging claimed it was capable of up to 500 Kbits/sec. Most of the cables advertised a max of 115200 bps. I distinctly recall being able to use the DC coder’s cable at 230400 bps a long time ago. Alas, 115200 seems to be the speed limit, even with this new USB cable.

Anyway, the distribution is based on a 2.4.5 kernel circa 2001. I tried to make PPP work over the serial cable but the kernel doesn’t have support. If you’re interested, here is some basic information about the machine from Linux’s perspective, gleaned from some simple commands. This helps remind us of a simpler time when Linux was able to run comfortably on a computer with 16 MB of RAM.

Debian GNU/Linux testing/unstable dreamcast ttsc/1

dreamcast login: root
Linux dreamcast 2.4.5 #27 Thu May 31 07:06:51 JST 2001 sh4 unknown

Most of the programs included with the Debian GNU/Linux system are
freely redistributable; the exact distribution terms for each program
are described in the individual files in /usr/share/doc/*/copyright

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

dreamcast:~# uname -a
Linux dreamcast 2.4.5 #27 Thu May 31 07:06:51 JST 2001 sh4 unknown

dreamcast:~# cat /proc/cpuinfo  Continue reading 

Launch Leech and the History of WMV

I was combing through my programming archives again and came across an old Perl script called launch-leech.pl. This was a private script I used to maintain for the benefit of myself and a few friends. See, there was this site called Launch.com (URL doesn’t seem to do anything as of this writing but here’s the Wikipedia page). Purchased by Yahoo! in 2001, Launch still maintained their independent branding. They also carried a lot of music videos, of which I am a huge junkie. launch-leech.pl was the tool I used to download the videos. This was particularly useful since I stubbornly clung to dialup internet access until mid-2004 and it would have been impossible to stream video at any decent quality (though there were 56k streams, so like I said– not possible at any decent quality).



Technically
I followed Launch.com for many years. To be honest, I only “followed” in that I figured out where their “latest videos” URL lived and regularly polled it. Each video had either a 6-, 7-, or 8-digit unique ID that could be plugged into the launch-leech.pl script which would then have a conversation with the relevant servers, determine the correct streaming URL with the highest quality, then download and save the URL by handing it off to an external program (first ASFRecorder, though I later switched to mmsclient).

At one point, I even wrote a crawler that compiled an offline database of all the videos, their IDs and their metadata. I never thought of anything interesting to do with it, though.



Windows Media Legacy
During these glory days of leeching, Launch.com streamed using Windows Media. I admit, it’s a bit of a blur now — the site might have used Real or QuickTime, but I was obviously most in tune with the WM side. I remember when I first found the site circa 2000-2001, the videos were in MS MPEG-4v3, and the high quality bitrate was 300 kbits/sec. Eventually, Launch.com would stream WMV7, WMV8, and finally WMV9, with bitrates up to 700 kbits/sec. However, they never broke free of the 320×240 encoding resolution, which was frustrating. When I wasn’t able to notice any substantial difference between 300 and 700 kbits/sec, I felt it might be time to put those extra bits to work on a resolution upgrade.

At least they were nice enough to re-encode a number of old videos using better codecs and bitrates with each revision, thus prompting me to scan through the site collecting updated video IDs for download.



Epilogue
I don’t clearly remember when I stopped visiting Launch.com. Video-wise, the web has been a blur of Flash video ever since about 2006. Meanwhile, I spent a lot of time collecting a bunch of music videos in the first half of the decade only to find that pretty much every version of every music video made since the dawn of time is available on demand thanks to YouTube. I have found that this phenomenon manifests in many areas as internet technology marches on.

The Real Entertainment
The launch-leech.pl tool represents a recurring pattern for me. I derive as much — if not more — entertainment from creating programs like launch-leech.pl (and implicitly reverse engineering something in the process; in this case, a website) as I do from the intended entertainment media itself. I seem to have this issue a lot with games, too.

Is this an issue for anyone else? Am I the only one who would rather play with the box that a shiny toy comes packaged in?

Naive Sorenson Video 1 Encoder

(Yes, the word is “naive” — or rather, “naïve” — not “native”. People always try to correct me when I use the word. Indeed, it should actually be written with 2 dots over the ‘i’ but who has a keyboard that can easily do that?)

At the most primitive level, programming a video encoder is about writing out a sequence of bits that the corresponding video decoder will understand. It’s sort of like creating a program — represented as a stream of opcodes — that will run on a given microprocessor or virtual machine. In fact, reading a video codec bitstream specification will reveal a lot of terminology along the lines of “transmitting information to the decoder” or “signaling the decoder to do xyz.”

Creating a good encoder that will deliver decent quality at a reasonable bitrate is difficult. Creating a naive encoder that produces a technically compliant bitstream, not so much.



When I wrote an FFmpeg encoder for Sorenson Video 1 (SVQ1), the first step was to just create a minimally compliant bitstream. The coarsest encoding mode that SVQ1 allows is to encode the average (mean) of each 16×16 block of samples. So I created an encoder that just encoded the mean of each block. Apple’s QuickTime Player was able to play the resulting video in all of its blocky glory. The result rather reminds me of the Super Nintendo’s mosaic effect.

Level 5 blocks (mean-only 16×16 encoding):



Level 3 blocks (mean-only 8×8 encoding):



It’s one thing for your own decoder (in this case, FFmpeg’s own decoder) to be able to decode the data. The big test is whether the official decoder (in this case, Apple QuickTime Player) can decode the file.



Now that’s a good feeling. After establishing that sort of baseline, it’s possible to adapt more and more features of the codec.