Getting Pages-generated ePubs with media elements onto the iBookstore
The problem
We have started publishing ebook versions of our Radio Lingua language courses on the iBookstore but earlier this year we encountered a problem when trying to upload our ePubs through iTunes Producer. We use Pages (part of Apple’s iWork productivity suite) to generate our ePubs. Through simple paragraph styles, Pages allows you to create rich multimedia ePubs easily. However, it seems that when Pages exports the ePub, any media files – even if they’re produced in Compressor and/or iTunes using the exact specifications dictated by Apple in the iTunes Connect iBookstore Asset Guide – are renamed with the extension .mov, rather than their original .m4v and .m4a.
Earlier versions of iTunes Producer let these files slip through, meaning that our first ePubs which made it to the store worked perfectly. The iBooks app itself on iOS doesn’t care what the extensions are – it plays the books perfectly, even with the .mov extension. The problem comes from the verification process in iTunes Producer which reports an unsupported media file format, referring to the .mov audio and video files.
With apparently no solution for this problem, we pretty much stopped production of our iBooks and focused instead on getting some of our content ready for Kindle. However, in the past few days, I’ve been able to solve the problem by piecing together various bits of information on websites and with the help of some patient people in Apple Education with whom I’ve been working on other projects. I’m posting my solution here, but I hope that Pages is updated soon to save us having to go through this fiddly process every time we want to upload a new title to the iBookstore!
The solution
- First of all, it will make a real difference if you’ve used a standard naming system for your audio and video files in your document. Since we export our video files using compressor and there are multiple versions of these files, we happen to name all our video files ending in -sd.m4v, eg. video-213-sd.m4v. Our audio files are numbered and end with the extension .m4a. However, with the Pages export, all of these files end up with the .mov extension, so the fact that we know our video files end in -sd.mov and audio files in a number will help as we work through these steps.
- Export the ePub in Pages using the standard settings as normal. The ePub file will work perfectly on the iPad, but as it is you will have problems uploading it to the iBookstore because of the verification process in iTunes Producer.
- Download the Automator-based contextual menu commands from Tidbits.com and install these following the instructions included. Since the ePub file itself is really just a zip file, you need to edit the files inside the zip file. That bit is easy enough, but if you recompress the zip file using the OS Compress command, you will get a different error in iTunes Producer and you’ll still not be able to upload the file. The reason for this is that the individual files need to be in a particular order within the zip file.
- Having installed these contextual menu commands as Folder Services, you can now control-click / right-click on the epub document and choose Expand EPUB. This will create a new folder on your desktop called work and inside that folder you will find the files which make up your ePub.
- You should be aware that the Pages export has simply renamed the media files – the .mov files are still .m4v and .m4a files, but they’ve just been renamed as QuickTime video and audio files.
- Open the OPS/media folder and you need to rename all the video files as .m4v instead of .mov. If you only have a couple of files you can change these manually. If you have many files to change you can create an Automator script which does this. I’ve created two mini apps which change the .mov to .m4v or .m4a and they’re available here. [Use at your own risk - if you prefer to create your own, here are the instructions] Remember only to change the video files at the moment.
- Repeat the above task for the audio files, renaming as .m4a instead of .mov.
- Now that you’ve changed the file names themselves, you need to change the links to these files in two places. We’ll start with the .xhtml files – your chapters of your ePub. I’ve used BareBones brilliant TextWrangler to edit my files – the Find and Replace functions work perfectly for this task. With the OPS folder, open each of the .xhtml files one by one. Again, if you’re just dealing with one or two videos or audio files you can change these manually. However, if you’re working with many audio and video files you can do a Find and Replace based on the names of your videos. In our case we find -sd.mov and replace it with -sd.m4v (as I’ve said before, we know all our original video files ended in -sd.m4v). Having done that, all the video files will be changed and it’s safe to assume that the remaining .mov files are audio, so we can do another Find and Replace, this time finding simply .mov and replacing it with .m4a.
- You need to work through all of the .xhtml files doing this find and replace so that there are no more references to any .mov files in your publication. Make sure you save changes.
- The other place you need to change the filenames is in the manifest file where all the associated files for your ePub are listed. Open the epb.opf file in the OPS folder, again using TextWrangler to edit the file. For each of the video files you need to change both the filename and the media-type. So this involves changing .mov to .m4v and media-type=”video/quicktime” to media-type=”video/mpeg4″. Likewise, for the audio files, change .mov to .m4a and media-type=”video/quicktime” to media-type=”audio/m4a”. Remember that iBooks for the iBookstore need to have .m4a audio – mp3 files won’t be accepted by iTunes Producer.
- Almost done! You now need to rezip the ePub folder, so select the work folder on your desktop and control-click / right-click and select Services > Zip EPUB work folder. This process will zip the files together in the correct order, and run epubchecker. After a few seconds you should find a new file on your desktop, book.epub and you’ll probably get an error message. Don’t worry too much about this error message – it’s coming from epubchecker and since media files are not permitted in the epub standard checked by epubchecker, the error message will relate to the media files.
- Finally, rename the file book.epub and you should be able to upload it without problem to the iBookstore.
I hope this is helpful to those of you who have had similar problems and that it helps more Pages users to get their enhanced content onto the iBookstore. Next challenge: get non-linear content to work from within Pages, so that we can create pop-ups or answer keys for our books! If anyone can help with that, please let me know!



Hello Mark,
I just discovered your radio network and blog. It’s impressive !
Stephane
We met several years ago when my daughter Jennifer from Arran High School went on a couple of the PIE trips to Strasbourg.
I found your Pictorial Scotland book on the iBooks store and noted the comments about using Red Jumper Studio’s Book Creator. I have now used this product on my iPad to create a photobook about walking the Tour Du Mont Blanc, which I did with Jennifer this summer.
To get your book published on the iBooks store, did you deal with Apple directly, or did you use the services of anothe company (eg Lulu)?
Hey Mark, I checked out the links for fixing the ePub with the expander. I am finding that either I have a strange system… Can’t find the location for moving the expand epub and zip work epub files to services at the ~/library/services but it is at system/library/services.
I copied the 2 files but was not able to expand or even select show contents of ePub file I need to fix. I have 8 MOV files and audio file names to correct thanks to pages. Do you have a little more insight on this procedure. I hope that Apple improves Pages export ability for ePub as it is a fairly easy program to work with although quirky and weird.
Mark,
Are you using Lion?
If so, the “user” Library is now hidden. Select any Finder window. From the Finder menu select GO and while still holding down your mouse or touchpad then hold down the OPTION key. You will see the drop down list expand by one item, the “user” Library. Select Library and you will then see the Service folder for “user” which is different then the one for “system”.
Drag the two file to that folder.
Hope this helps.