QTIndexSwapper AIR Application for Flash Player H.264 files

August 22nd, 2007

2007.12.28 UPDATE: v1.3 of QTIndexSwapper requires AIR Beta 3

With the release of the Flash Player 9 Update that supports H.264, we can now play a subset of H.264 movie files. The problem is most of the H.264 files have the index at the end of the file which for progressive download means you have to download the whole file before you can start watching any of the video.

In the notes from Tinic Uro, Adobe engineer working on the changes, there is mention of a C application that helps with rearrange the inwards of a movie to put the index at the beginning. Thus help with the progressive download issue. To this end I have create an AIR application which does the index swapping for you.

Its called “QT Index Swapper” (v1.3 using AIR Beta 3 as of 2007.12.28), get it at http://renaun.com/air/QTIndexSwapper.air. And if that isn’t enough I have also made the source available inside the AIR application.

There will probably be some quirks and many files that might not work. But give it a try and let me know what you think. I was converting 500Mb-600Mb movie files that I have in MP4 format to play on my PlayStation 3. The files were being converted in under a minute, just beware that the AIR app might act like it is hanging while reading that much information. Just wait for it to run and watch the new file being created.

Entry Filed under: AIR (formerly Apollo), Adobe Flex, Rich Internet Applications

26 Comments Add your own

  • 1. maliboo  |  2007-08-22 at 5.39 am

    Great job! Maybe you can switch from sync to async mode on file operations? This could eliminate application “freeze”.

  • 2. two forty eight » B&hellip  |  2007-08-22 at 7.25 am

    [...] QTIndex Swapper one of the issues with .h264 files is that the index is at the end of the file. Here is a nifty utility to re-arrange it back to the front so you can start watching the video after the buffer is full instead of waiting for the entire file to be downloaded. [...]

  • 3. Abdul Qabiz  |  2007-08-22 at 8.18 am

    Cool! That shows what all can be doing with AIR, it means, one can port many such C applications to AIR…

    It’s useful, I am gonna use it for all video files I have…

    Thanks

    -abdul

  • 4. Renaun Erickson  |  2007-08-22 at 8.55 am

    I did think about using the Async file I/O stuff, and most likely it will get rid of the freeze affect. Will have to try it the change sometime.

  • 5. Renaun Erickson  |  2007-08-22 at 8.57 am

    @abdul Good point, it was surprising pretty easy to port. Did it in about one work day, of course I didn’t spend time optimizing and/or testing a bunch of files. But I agree AIR can now be a good alternative to many small C apps.

  • 6. Mike Melanson  |  2007-08-22 at 4.23 pm

    Hi!

    I wrote the qt-faststart.c utility from which QTIndexSwapper is ported. Good stuff; gives me a good point of reference for reviewing some ActionScript techniques. A few things on stream reading:

    You probably want to use the readUnsignedInt() method vs. readInt(). You don’t want to restrict this to files under 2 GB (or risk strange behavior beyond that limit).

    When patching a 64-bit chunk offset atom (co64), the readDouble() method does not do what you think it does. That method construes the next 8 bytes in the stream as an IEEE double-precision floating point number, not a 64-bit integer.

    Or maybe it does work and I don’t recognize why. Have you tested on files with co64 atoms yet?

  • 7. Renaun Erickson  |  2007-08-22 at 4.44 pm

    Hey Mike,

    Now the 64 bit was left with some bugs, I don’t have any co64 files. I did think about the sign/unsigned issue but just wanted to get something that half way worked. Basically I did a port not really understand complete what it was doing.

    Do you have some test files I can use to test the co64 atoms?

  • 8. Hurry  |  2007-08-26 at 2.51 am

    It does not work with mp4 files encoded with the MainConcept mp4 encoder. The ouputted files do not play locally in QuickTime neither int he beta Flash player on the web.

    Original file:
    http://www.mediafire.com/?5zbgzc9gpil

    Converted file by your QTIS: http://www.mediafire.com/?1v0duedtf9y

    The original files plays perfectly in beta Flash player but only after downloading fully. Adobe has\ve used the MainConcept decoder so I think my original file would be one most compatible files with flash beta since it is encoded my the mainconcept encoder. I hope you fix this bug. Thanks.

  • 9. Hurry  |  2007-08-26 at 2.56 am

    QTIS asked me for confirmation whether it was a quicktime file but in the output it said 0 bytes for the final file though the final file was the around the same size.

  • 10. Renaun Erickson  |  2007-08-27 at 8.05 am

    The QT Index Swapper only work with files using the QuickTime format. It should stop, and not create the output (final) file if it does not think its a QT formated file, so thats a bug.

  • 11. RealEyes Media - David Ha&hellip  |  2007-08-31 at 10.30 am

    [...] Now I also stumbled across this spiffy AIR that would also take care of adjusting the moov atom to enable streaming of the H.264 content for you. You can find that here: QTIndexSwapper - http://renaun.com/blog/2007/08/22/234/ [...]

  • 12. Corben9  |  2007-09-03 at 3.32 pm

    x264 encoded content muxed in mp4box…

    Ok since i have a large file id like to have progressivly streamed and the option in MP4box didnt exactly work i treid the QT swapper and it did swap the atom . My file is a 4Mbith High Profile 720p file.. u can find it here > http://www.studioc9.com/CevapiSession/CevapiSession.mp4

    and the flash html> http://www.studioc9.com/CevapiSession/HD.html

    Now oddly even after the moov atom is in front it doesnt start playing … it loads to oblivion eating up a horendes amout of virtual memory *more then 2 gigs* until the datatransfer just stops… now it could be becouse of the 64 bit atoms … sicne the filesize is more them 600 MB .. anyone have any expirience .. the file hower does stream directly in VLC if u add enough prebuffer and the site with the file works perfectly localy…

    Is this kind of behaviour a limitation in Flashes h264 impelmentation or does it really only progressive downlaod with files made in Quicktime ?

    I know im taxin the entier thing by puting a 4 Mbit file on the web but i wanted to test if its possible to use any sort of standard high profile content …

  • 13. Renaun Erickson  |  2007-09-03 at 11.39 pm

    The QT Index Swapper does not work correctly with 64 bit atoms. I need a file to test with. If the file worked with out it going through the QT Index Swapper on the web then its most likely mixed up the indexes.

  • 14. Jim Waterwash  |  2007-09-06 at 6.12 am

    Mainconcept encoder is used in Vegas Video. so it would be great if this app could work with those files. I have many files that take over 8 hours each to encode.

  • 15. Renaun Erickson  |  2007-09-11 at 8.41 pm

    This QT index swapper only supports QuickTime formatted files. What does that really mean? I am not quite sure, i just ported the original C app.

  • 16. Flash Player 9 Update 3 B&hellip  |  2007-09-19 at 1.32 pm

    [...] Wer das Ganze einmal ausprobieren möchte, sollte allerdings darauf achten, dass das Movie bei progressive downloads erst abgespielt wird, wenn es vollständig heruntergeladen wurde. Das liegt am Index bei MPEG-4, dem so genannten moov atom. Er enthält Zusatzinformationen zur Datei. Premiere und After Effects legen ihn zur Zeit generell an das Dateiende. Damit Flash nun das Video sofort abspielen kann, müsste er sich aber am Anfang befinden. Einen einfach bedienbaren Fix für encodete H.264-Videos gibt es im Blog von Renaun Erickson, - den “QT Index Swapper”. Dafür wird die Adobe AIR-Runtime (gibt es leider bisher nur als BETA-Version) benötigt. Eine andere Möglichkeit bietet der Quicktime-Encoder mit der Option “Schnellstart”. [...]

  • 17. Neil Brown  |  2007-10-08 at 9.05 am

    Hey,

    I just downloaded the latest version of AIR and it says your app won’t work with it, any ideas?

  • 18. Renaun Erickson  |  2007-10-08 at 9.14 am

    the app needs to be updated to beta 2. I’ll get to it some time.

  • 19. Breaking Eggs And Making &hellip  |  2007-10-18 at 7.27 am

    [...] It’s weird to think that I may have already written the most popular piece of free software that I will ever program– qt-faststart. It’s easily the most ported of all my programs– at the very least, there are native versions for Mac OS X (Cocoa wrapper) and Adobe AIR. [...]

  • 20. Dewey  |  2007-11-24 at 10.31 am

    You rock, sir. Wanted to serve some h.264 files created from home movies on dvd via simple embedded html tags and the quicktime plugin, but of course, the plugin was downloading the entire file before playing. Thanks to your QT Index swapper, this now works as I hoped it would. Thanks!

  • 21. Renaun Erickson  |  2007-12-28 at 10.54 pm

    version 1.3 is available now, it requires Beta 3 and I’ll post more about the updates later.

  • 22. Why is my progressive H.2&hellip  |  2008-01-23 at 9.21 am

    [...] Scouring the web I did find a utility that moves the moov atom to the start of the file. Renaun Erickson ported a C app to AIR that moves the moov atom and resaves the file. Very impressive! Unfortunately it didn’t fix my issues, Renaun’s app only works with .mp4 files and the files I was working with are .mov files. Using Quicktime Pro I exported one of the .mov files to a .mp4 to see if Renaun’s app would then move the moov atom. Still no luck. As a last resort I tried a simple Save As from Quicktime to see if it would restructure the bytes so the  moov atom was at the beginning of the file. Guess what, it worked! My progressive downloads now worked. I create a simple batch and saved out all my progressive videos using Quicktime. [...]

  • 23. Andy G  |  2008-02-17 at 4.12 pm

    How do I install this utility and where? Where do I have to include this file to work my videos? In quicktime..or in Flash CS3…where??
    Please help me out!

  • 24. :: reykroona.com :: &raqu&hellip  |  2008-05-16 at 10.09 am

    [...] for now, you can download an AIR app called QTIndexSwapper that will fix the file for you. One cool thing about AIR apps is they run on OS X and Windows, so [...]

  • 25. Colin Britton  |  2008-05-31 at 5.52 pm

    How are would it be to make this process a whole folder. That would be a great enhancement.

  • 26. Renaun Erickson » A&hellip  |  2008-06-16 at 9.24 am

    [...] Related posts: http://renaun.com/blog/2007/08/22/234/ [...]

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Disclaimer: I work as a Flash/Flex Developer for Adobe Systems Incorporated. The opinions expressed here represent my own and not those of my employer.

My Amazon.com Wish List

Calendar

August 2007
S M T W T F S
« Jul   Sep »
 1234
567891011
12131415161718
19202122232425
262728293031  

Most Recent Posts


Flex.org - The Directory for Flex