Monday, September 27, 2010

With the Pages application (part of Apple's iWork suite), we can now easily include audio and video in our ePub-based eBooks. These advanced eBooks are viewable only in the iBooks application on an iPad, iPhone or iPod touch but these iOS devices are selling like hotcakes so that's OK for now. The others will catch up eventually.

However, easy as it is to include audio and video in an ePub using Pages, we still have to exercise care in preparing these media files for our eBooks. It's is quite easy to create a video file that won't play back properly or at all and we don't want to inflict that kind of experience on our readers.

Obviously, Flash is out so we are talking about files that are in an MPEG-4 or QuickTime container. But that's not all. We also have to make sure that the CODEC used for the video track is H.264 and the CODEC used for the audio track is AAC. In addition to that, we must take care to keep the data rate, expressed in bits per second, below certain threshold values. Here, for example, are the
technical specifications for the iPad. Read the sections on "Audio playback" and "TV and video" to get the general idea. No need to study or memorize these, just get the flavor and we'll move on.

These specifications are all aimed at accommodating the requirements of the firmware chips in most mobile devices that decompress and display video. Using dedicated and specialized firmware is far more efficient than decompressing video in software. This yields superior performance and a good video experience.

So, with all of these specifications, it should be easy to get things wrong, right? No, that's not the case. There are lots of virtually foolproof ways to make sure that the audio and video you include in an ePub file will play back properly in iBooks on an iOS device, currently the only venue where this kind of media can be played back in an ePub file.

There are two general scenarios that will determine how best to proceed: whether we are creating the media from scratch or repurposing extant media. Let's examine both cases.

Creating and exporting media from scratch. This is easiest scenario but has the most variations. If you are creating video with or without an audio track, always export using the iPhone preset (480x360 ). This will usually keep the data rate below one megabit per second which will perform very well on any iOS device. There are many applications that create video. Similarly, audio-only applications have iPhone presets. Here's a screencast medley of popular MacOS X apps that export video and audio that will be playable in the iBooks app on iOS devices.

Repurposing extant media. There are several good approaches to this task depending upon the characteristics of the source video. The general goal is to convert the source file into a 480x360 H.264/AAC file in an MPEG-4 or QuickTime container. Source files can be almost anything (Flash, DVD, Windows Media, AVI and so on) but you may need to extend your MacOS X system with extra QuickTime components in order to handle all of these. Here is a short list of the most important QuickTime components to add:

Perian (free) Formats supported: AVI, DIVX, FLV, MKV, GVI, VP6, and VFW
Flip4Mac WMV ($29) Formats supported: Windows Media video and audio

Here is a list of applications that are useful in repurposing non-MPEG-4 files to the proper iPhone specs:

Handbrake 0.9.4 (free) Converts DVDs to MPEG-4, including iPhone output.
Miro Video Converter 2.2 (free) Converts almost anything to MPEG-4, including iPhone output.
CosmoPod ($12) Downloads and converts YouTube and other Flash video to MPEG-4 iPhone output.
QuickTime X Player (free) Converts anything it can play (see components above) to iPhone format.
MacOS X Automator
Movie Services (free) Converts andy QuickTime movie to iPhone format.

Here's a screencast medley of these applications at work repurposing video that will be playable in the iBooks app on iOS devices.

No comments:

Post a Comment