Starting with Apple’s ePub template, we create a test project. To follow along, download the “ePub best practices” document from Apple’s “Creating ePub files with Pages” support document, open it in Pages and do File > Save as template … which makes this template available to us now and in the future.
After we have the template saved, we add a 75 MB 1280 X 720 video with a duration of 5 minutes and 36 seconds (download) to the still open Pages document. It now looks like this:
The next step is to export this document as an ePub (File > Export To > ePub …). As we look at the output of this process in the Finder, we see that the ePub is about 280 MB despite the fact that the parent file, the Pages project, is only 80 MB in size. Here’s what that looks like:
As far as I know, there is no application that can add useful data to source video. So, what is going on? Could this be an instance of unnecessary …
… video bloat? The following delves into how to investigate that possibility. The first step in that investigation is to download ePub Zip Unzip so that we may peer inside the ePub file structure, find the video file and compare it with the original that was initially fed to Pages. This app has a very simple user interface that looks like this:
The reality of an ePub file is that it is actually what is called a package file, a folder containing a variety of files that has been archived into a single file using the Zip compression algorithm. What ePub Zip Unzip does in this first step is simply to unzip the file into the folder it started out as. Once we have unzipped the ePub file, we can open this folder and examine its contents. Specifically, we’re interested in the video media because this is the only thing that we added to the Pages project beyond the template itself. Here is what we see:
Clearly, we are looking at an instance of file bloat. The video file has grown more than 200 MB beyond its original size. This is not likely to be an improvement. To determine why this is so, we turn to another free, open source app called MediaInfo. Note that QuickTime X Player will also provide the most essential of this data but MediaInfo can provide additional data that is very useful to advanced users. Here’s what MediaInfo says about the original file:
… and the video file exported by Pages:
Here’s a table summarizing this analysis:
The change in suffix from .mp4 to .m4v is inconsequential but the change in bit rate is key. The bit rate is 3.5 times greater than the source file! This is precisely what has inflated the file size. The formula for file size is bit rate times duration. So, will our readers benefit from this larger, longer to download file? Let’s see.
Link to full size version of this video: click here (opens in a new window)
Quite frankly, I see no improvement. Certainly not an improvement justifying an additional 200 MB in file size.
So that’s the problem. Now, how do we fix it? We already have some terrific clues. We have the ePub on the operating table and opened up so we can see and operate upon all of the internals. Why not try to replace the bloated video with the more efficient one that we started with. Here’s how:
First, we move the better file into the same location as the bloated version. Note that they have different names. This complicates things just a little bit. So copy the good video into the same folder as the bad video, like this:
This is a simple drag and drop operation in the Finder. Next, we copy the full name of the bad video like so:
Move the bad (bloated) file to the trash like so:
Select and paste the name of the bad (bloated) file renaming the good file like so:
Accept the change in the file suffix like so:
Zip the folder back into an .ePub file like so:
Enjoy the success of having reduced the file size of your ePub.
Test the results in the iBooks.app to confirm that success.
No comments:
Post a Comment