Monday, September 27, 2010

Pages exports video in EPUB incorrectly

One of my big surprises while testing Pages was the way it treats video. Apple claims on its website that Pages supports exporting video in its EPUB files, and thus, Pages would seem like a great tool for creating enhanced ebooks.

Unfortunately, it's not. And frankly, it just looks like sloppy coding to me. Honestly, I don't understand it.

I created a new Pages document and dragged a video into it, while holding down the Command key, so that it would be "inline" (required for Pages to export to EPUB).

I then exported the resulting document to EPUB. And although the EPUB file passed EpubCheck validation, the video doesn't actually play in iBooks.

Video has Broken Play in Pages EPUB

That seemed strange to me, so I opened up the EPUB file and looked at the XHTML files generated by Pages. They don't follow Apple's own recommendations!

The problem seems to be that the video is embedded in the wrong format: .mov instead of .m4v. And the file is declared incorrectly in the manifest in the opf file: video/quicktime instead of video/mpeg4.

Indeed, if I make these small adjustments, the video plays perfectly fine. (You can get full details from my book: EPUB: Straight to the Point.)

Also note that although the above referenced document doesn't claim that Pages supports audio, Pages does, sort of. It actually exports audio to EPUB also as a QuickTime file, but somehow it works anyway. Nevertheless, it doesn't follow Apple's own recommendations as outlined in the "iBookstore: Publisher User Guide 1.3.1", which state that audio should be have the .m4a extension. And Apple's sample file uses "audio/mp4" as the proper mime type in the OPF file, while Pages exports as "video/quicktime".

It's downright frustrating that Apple's own tool for creating enhanced EPUB files don't work in Apple's own ereader!

24 comments:

  1. May we have a link to the Apple document entitled, :iBookstore: Publisher User Guide 1.3.1?"

    ReplyDelete
  2. It's not mine to publish. You have to have an iTunes Connect account to get to it.

    ReplyDelete
  3. Thanks for all your very useful research on this. Maybe Apple will listen to you and we can get these corrections in the next version of Pages!

    Is the video going into the ePub as HTML5 or as object. I guess the latter is the only way it would get let into the iBook store?

    ReplyDelete
  4. Pages adds the video with HTML5, it just uses the wrong encoding. If it used the right encoding, it would work just fine.

    I assume that a Pages-generated enhanced ebook would not be accepted into the iBookstore since it does not work properly, but I haven't tried to upload one myself.

    ReplyDelete
  5. Congratulations for your new book and your great work!

    I have been working for a while editing epub books for my iPad, struggling with pdf to epub conversions and so on. At this moment, I have got some good results with nice-looking classic books and scientific papers in pdf as well.

    I just wanted to let you know how amazing it was to reach to your website and blog.

    By the way, as probably you already know, when I tried to follow your post by inserting a movie from QuickTime to a Pages document, it worked well without touching anything. I could see and listen to my video inside the epub book with no problems.

    ReplyDelete
  6. @Jeronimo: Thanks for your nice comment. Can you tell me more about the video you put in Pages. I have not had the same luck.

    ReplyDelete
  7. Just inserted the video with: Pages - Insert - Choose - name_of_video. The default is inline. And then, Pages - Files - Export to epdb.

    It works well in my iPad. The opf file contains the movie in .mov format and the manifest is also video/quicktime.

    Hope it helps. Maybe I have been kucky. I will keep investigating.

    ReplyDelete
  8. @Jeronimo: Interesting. I wonder what's different. Are you viewing the book in iBooks 1.1.2 like me?

    ReplyDelete
  9. Yes, I am using iBooks 1.1.2. I wonder if this is just another strange behaviour of epub books in iPad. For instance, I am using Sigil to edit epub books and from time to time I find issues with functionalities that work well within Sigil, but that do not work once the book is viewed in the iPad. As an example of something I have been trying to resolve is the following: I have an epub book with 200 footnotes and some of them work well and many other return to the beginning of the chapter instead to where the references are. More strange is that I can not understand where are the chapter names stored, because I erased all of them from my html files and .opf and .ncx as well, but these chapter names still appear at the bottom of iBook reader. It is making me crazy. Any hint on that?. Many thanks.

    ReplyDelete
  10. Hmm. I'd do a search for one of the chapter names over all the files in the ebook (can Sigil do this? if not, BBEdit can). It can't produce the chapter names out of thin air... or could it be that you have multiple files and are editing some but viewing others? I've done that before.

    I'm really stumped with why Pages can do video for you and not for me. Would you ever be willing to send me the resulting EPUB? (lcastro followed by at then by cookwood.com).

    ReplyDelete
  11. Sure, no problem.

    ReplyDelete
  12. Well, there is a problem indeed: Icastro@cookwood.com fails to my email.

    ReplyDelete
  13. First letter is an "l" for Liz :)

    ReplyDelete
  14. Done. Sorry, I was in hurry and confused first letter.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. If I understand the problem correctly from the interchange above, I'd guess that movies that fail are not within the specs for iOS devices, specs that are much more stringent than for desktop playback due to the fact that video on iOS is done via firmware instead of software. I tried to address this issue in a recent blog post: http://frank-lowney.blogspot.com/2010/09/insuring-playable-audio-and-video-in.html directed toward university faculty exploring ePub-based eBooks. The essential advice is to stick with iPhone presets for export or sharing as Apple calls it. There are not yet any presets for iPad but I expect to see them eventually.

    ReplyDelete
  17. We run a publishing company which has been uploading a series of iBooks upon to the iBookstore called 'iCook'.

    These are all enhanced books with videos. We edit the videos in iMovie and then export them into the Media Browser whereby we insert them into Pages and export to ePub and upload to Apple.

    This process has worked for nearly half a year now but as of recently we upload the ePub files and it tells us .mov is an unsupported file type.

    Anyone else having this problem. We have emailed and contacted the iBookstore team but it's been two weeks and they haven't gotten back to us.

    ReplyDelete
  18. @Anonymous: Interesting. I have been able to use .mov files as long as they have the correct encoding, but I will check again to see if anything's changed. I'm in the process of creating a new miniguide on video and audio and hope that will be shed some light on this whole topic as well. I'll post info here on my blog when it's available.

    ReplyDelete
  19. @Liz Castro: That would be most appreciative. Very interested into seeing whether or not the ePub with a .mov uploads or gets an error.

    The mini guide sounds very interesting and we look forward to seeing it.

    ReplyDelete
  20. Hi Liz and Universe,

    Hope all is well. My name is Sumner from NY and I'm going crazy trying to get this right. I hope you or anyone can offer some help. I'm tired and I need it. I've written a book in Pages 09' and embedded it with QT video in h.264 format. The video exports in Epub format and plays on Apple mobile devices just fine. However, upon trying to get it to pass Epub verification, it fails every time. Here's the message I get -

    ERROR: /Users/sumner/Desktop/MEMOIR/If You Survived The Battle of the Bulge The Rest is a Piece of Cake - Sumner Jules Glimcher.epub/OPS/chapter-12.xhtml(5): unknown element "video" from namespace "http://www.w3.org/1999/xhtml"


    No service I know of will do the conversion and this is the last hurdle upon placing the book on the Ibookstore. Could you, Liz and/or anyone help me and tell me what's wrong? Is it video format? What should I do to get this to pass verification?

    I'd be grateful for any help. Here's my email address.
    sumner.glimcher@nyu.edu

    Thank you so much.

    ReplyDelete
  21. Hello Sumner: This (and the similar audio error) is the only EpubCheck error that Apple doesn't mind. You can submit your ebook to the iBookstore.

    ReplyDelete
  22. Like the iCook people mentioned above and a few others we've had the same problem: our language books are created in Pages and use .m4v and .m4a video and audio created exactly as Apple require in the Asset Guide. We submitted a number of books through iTunes Producer and they all worked perfectly, but for the past few weeks we have not been able to submit anything because we keep getting the error message about unsupported file types - because Pages seems to be converting the .m4v and .m4a files to .mov files on export.

    Our latest books contain hundreds of audio files and many video files, so opening up the .epub folder and editing the .xhtml manually and changing the extensions of the files in the media folder is not practical. Has anyone found a solution for this?

    ReplyDelete
  23. Hey Liz,

    Greetings! How are you, Liz? Hope summer and life is treating you kindly. I send my best.

    Thanks for your response to the question I submitted. I appreciate it greatly.

    I used Tunecore to the Submit the book and when they attempted to submit the book to the iBookstore, this is the error message they received -

    Apple's web service operation was not successful
    Unable to authenticate the package: 9780615480992.itmsp
    ERROR ITMS-9000: "Unsupported file type found : media/MEMENTO%20FIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/HIRO%20FIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/NORTH%20FIXED-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/GIACOMETTEI%20FIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/PROBLEM%20FIXED-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/JOHN%20WAYNE-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/ISRAEL%20FIXED-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/GHGH%20FIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/MASTERPIECES%20-%20FIXED-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/CONFUCIUS-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/OWFIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/FINE%20DINING-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/panama,%20new-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/ALASKA-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/VAMPIE%20NEW-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/9-11%20money%20shot-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/9-11-%20new-whole-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/PROVENCE%20FIXED-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/FABLE,%20FIXED-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/D&A-2.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/GALBRAITH%20HArvaerd-1.mov" at Book (MZItmspBookPackage)
    ERROR ITMS-9000: "Unsupported file type found : media/Galbraith%20Sample%20LOCKED-2.mov" at Book (MZItmspBookPackage)

    All the error messages are the for .MOV files, (h.264, AAC audio). The .Epub file came straight out of Pages 09', all videos are inline, and I'm baffled.

    What could be wrong? Format the video as MP4? Something on Apple's end. This is so frustrating.

    If you have any ideas, please let me know how to proceed. I'd appreciate any help I can get. It seems to get this done with people who know how to do it is terribly difficult. What you're doing is angel's work.

    Thanks, Liz.

    Sumner Glimcher.
    sumner.glimcher@nyu.edu

    ReplyDelete
  24. Hope this is useful to those of you having similar problems. We've finally been able to solve our video problems and I've documented the full process here: http://www.markpentleton.com/2011/09/12/getting-pages-generated-epubs-with-media-elements-onto-the-ibookstore/

    ReplyDelete

More of my books