Chris Adamson, author of QuickTime for Java

I can remember when Java was released and the big fanfare about multimedia capabilities and cross-platform programming. While the latter has, almost, been realized, the multimedia abilities of Java have been less than successful. QuickTime has rapidly become a standard for multimedia work and, through the QuickTime for Java (QTJ) we can make use of the strong facilities in QuickTime from within Java applications.

QuickTime for Java: A Developer’s Notebook, recently released by O’Reilly, covers a wide range of topics on using QTJ, from creating basic video players to using QuickTime for manipulating images, audio files and even importing and encoding movies direct from source. On each occasion, we get a full breakdown of what to do, the full source code of the example, and a description of what is happening and why.

I talked to Chris Adamson, author of QuickTime for Java: A Developer’s Notebook, about the book, QTJ technology and his other projects and interests.

First of all, tell us a little a bit about what motivated you to produce the book, and if you’ll pardon the publisher pun, in a nutshell what it’s all about?

Well, in the world of Java Media, QuickTime for Java is sort of an odd man out. Sun’s media API’s enjoy the benefit of incumbency – they’re featured on Sun’s website, covered in some general purpose Java books, etc. – but a lot of developers try them and walk away angry because they don’t support any real-world media formats. Then they hear about QuickTime for Java, they get excited because they know QuickTime supports all sorts of media and they know Apple has real credibility in media… and then they get discouraged because it’s hard to get started, the documentation is dreadful, and there’s this implicit assumption that you’re supposed to be a C-based QuickTime programmer before you try QTJ.

So, my goal was to create a QuickTime for Java book _for_ Java programmers, so you’d be able to pick it up and start coding real tasks, and have any weird Mac legacies explained along the way.

What struck me when I read it was how quick and easy it was to do relatively complex tasks. For example, you provide a simple command line audio player in just 25 lines. This is, I guess, the power of the QuickTime libraries?

25 lines is _good_? I actually think that’s pretty brutal for the “hello world” of media. In Java Media Framework, you could create a player with just a single functional line… the problem was finding anything it could play. But back to QTJ, this is part of the challenge of getting into QTJ: for this little app, you’re responsible for managing the session, you have to make a couple of calls to get the object into something QuickTime’s Movie class can open, since you don’t have a GUI you’re responsible for tasking… a lot of little hassles that steepen the learning curve. But they’re things you do in every QTJ application, so once you’re used to them, it’s no sweat moving on to bigger things.

I think where QTJ starts really paying off is in the advanced stuff, because you can access the movie data in a lot of different ways. For example, someone asked on the quicktime-java list the other day how to “burn in” a logo on top of a movie. QuickTime gives you lots of ways to do this: you can paint on every frame of the movie and re-export it, or you can create a new transparent video track that only has a single, movie-long frame that shows the logo, and export that. Or do it with sprites. Or probably something else I haven’t even thought of. The point is, some frameworks don’t give you any low-level access to the media at all, while QuickTime has lots of options.

Why use QuickTime with Java instead of one of the C-based APIs?

Ah, you’re thinking from the Mac point of view. If you’re asking this question, then the one advantage is that if you plan to run on both Mac and Windows, it will be easier to maintain a single Java codebase than to have to compile and run separate Mac and Windows versions. Not that it’s that hard, though – Tim Monroe’s “QuickTime Toolkit” books are about the straight-C API, and they introduce a simple cross-platform QTShell application that his examples are built on.

There are two ways of choosing QTJ: assume QuickTime and pick a language, or assume Java and pick a media framework. QTJ was built for the first scenario, but it’s turning out to be the second one that really matters. People building enterprise content management systems, distributed production systems, etc., are often Java-philic because of its popularity in the enterprise, so QTJ becomes attractive as a client-side piece for playing, creating, editing, and/or capturing the media to be managed.

The book demonstrates a number of useful little utilities, such as saving movies in alternative formats. Do you use many of these in your own media applications?

A few, but most of them were written exclusively for the book. The problem with repurposing is that you can fail to really illustrate something if you drag in too many extraneous details.

I was surprised at how much functionality in QuickTime is not directly related movie playing, which is probably what most people would associate the technology with. Could you give us some examples of things QuickTime does that don’t involve movie files?

Most people don’t realize there’s a whole graphic side to QuickTime – drop a JPEG or a PNG on QuickTime player sometime. Or, for that matter, a PhotoShop document or a PDF (Mac OS X only). You can even page through the PDF the way you’d step through a movie. Anyone up for using QTJ as the engine for a server-side PDF-to-JPEG-thumbnails web-service?

The MP3 and AAC examples seemed overly complex to me. Does it surprise you that there isn’t an easier method of extracting this information?

The AAC one is pretty nasty, but probably not surprising since that stuff is officially undocumented. Maybe within Apple they have some convenience API’s to get at that info in the iApps.

On the other hand, I can say from experience that QuickTime makes getting the tags from MP3 files much easier than doing it yourself. I wrote an ID3 tag reader for an open source project called jicyshout ( which brought Shoutcast-style http-stream audio to the Java Media Framework. At least it did… for a month… until Sun took MP3 support out of JMF because they couldn’t afford a decoder license. Anyways, I wrote tag readers for Shoutcast’s barely-documented tag protocol and for ID3. To support ID3, you actually have to look at every frame of MP3 data, calculate offsets, see if there’s anything between the frames, see if it starts with “ID3″ and if so, parse it. It’s a lot of work to get right… I think JavaZoom actuallly reworked some of jicyshout’s code into their players, but at any rate, I’m grateful that QuickTime parses it for me.

Many of the applications in your book are incredibly useful, even more so when combined with the source code. For example the video and audio recorders, and the MP3/AAC tag dumpers. Does it surprise that some of these tools are not supplied with QuickTime?

Well, to be fair, QTJ used to ship an SDK with about 50 demos, many of which were short, sweet and useful. Because of a major re-organization of QTJ a few years ago, about half of them were broken and taken out. But Apple still gives you some good stuff like basic players, a sound recorder, low-level movie makers, etc. I couldn’t have written the book without some of the secrets revealed by their demos. The C API is even more generous with its demos.

You’re editor and associate editor of two of the best Java resources on the Web; O’Reilly’s ONJava and respectively. Could you tell us a bit about the work you do at these sites?

ONJava is very article-oriented, so most of my hours there involve straightforward editing – soliciting articles, helping authors organize and write them effectively, and trying to find new topics we should be on top of. is different because the community is the focus, so while we run articles in a manner very similar to ONJava, we’re really interested in people hosting projects on the site, participating in forums, joining communities on the site, etc. takes a lot more people to make it work: it’s a collaboration of Sun, O’Reilly, and CollabNet, and the editor-in-chief, Daniel Steinberg, does a huge amount of work to keep the site relevant and interesting for Java developers, and I try to back him up with article editing and blurb-writing.

There’s a fair amount of material crammed into the book. Is there anything you wanted to include but didn’t make it?

I wish I had included broadcasting, i.e., streaming from your application, but it was widely believed not to work in QTJ when I was working on the book. Since I was already working in one feature that supposedly doesn’t work but actually does (video capture) I thought two would be pushing my luck. Instead, I went back after finishing the book, got streaming working, and wrote an article on it for ONJava. That’s something I’ll probably be revisiting, by the way.

Perhaps the most obvious omissions are sprites and QTVR, but I’m not sure those are as interesting to people outside the Apple and QuickTime realm. Sprites, in particular, are a prickly issue, because the QuickTimers are justly proud of them – with the ability to wire up sprites with code, you can build a GUI entirely within QuickTime, make a game that runs entirely within QuickTime, etc. You literally just hand out an .mov file and that’s all the client needs. And while that’s great… it may be irrelevant. The dominant paradigm now is for something outside of QuickTime – a C application, a Java application, a web page with JavaScript, etc. – to provide the interactivity and to control of the media inside the movie. So, given what it would have taken space-wise to cover sprites adequately, I left them out. So far, no hate mail.

Finally, I was going to have a little thing on playing Shoutcast-type http-streaming audio — you’re supposed to be able to just change the protocol in the URL from “http” to “icy” and any QuickTime app can play that stuff. When I proposed the book, it worked with all my streams; things have changed and today it only works with one.

Your book highlights a fairly eclectic set of music tastes. Is that because of, or in spite of, your multimedia work?

No, it’s just my weird taste in music. I think my problem is that I really like melody, which is atypical in the U.S. Frank Zappa said “in American music, timbre rules,” and he was right – here it’s not the melody so much as the overall sound of the music. That’s why you can create music here that doesn’t really have an idea or a feeling behind it, you just “lay down some beats” on a multitrack recorder and start adding parts until you achieve your desired sound.

Unfortunately, this results in music that bores the p*** out of me.

It’s really annoying that the iTunes Music Store won’t let me buy from other countries’ stores. So that means pricey imports from the UK and Japan down at Tower Records and via Amazon.

By the way, it’s rubbing off on my family. My two-year-old will run into the room whenever he hears J-Pop, and one of his favorite videos is “Roxy Music: Live at the Apollo”

Any more books in the pipeline?

I’m working on a Swing book with this guy that I worked with a few years back. He keeps coming up with crazy-cool stuff to do with Swing, so we’re compiling some of our favorite tricks into one volume. He’s so good, he just got a job working for the Swing team at Sun.

Chris Adamson is the Editor for O’Reilly’s ONJava site and the Associate Online Editor of, a collaboration of O’Reilly, Sun Microsystems and CollabNet. He also writers about Java and Mac topics online, and speaks at conferences such as ADHOC and the O’Reilly Mac OS X Conference. He developers media applications under the guise of his consulting company, Subsequently and Furthermore, Inc.
He is also a software consultant, in the form of Subsequently and Furthermore, Inc. He has an M.A. in Telecommunication from Michigan State University and a B.A. in English and B.S in Symbolic Systems from Stanford University. He lives in Atlanta with his wife, Kelly, and their son, Keagan, with another child imminent. He has thus far managed to own seven and a half Macs.


Comments have been disabled for this post