You’ve got an H.264-based MOV file that you want to use for Flash production, but it won’t load into Flash or Flash Catalyst. Can you simply change the extension from MOV to F4V? If you’re encoding the file, should you choose None, Fast Start or Fast Start – Compressed Header when producing for progressive download. Read on for the answers to these questions and more.
Ever have one of those days where something that was supposed to take 15 minutes ends up taking 3 hours that you sorely don’t have? Me too. In fact, today was one of those days.
Here’s the background. I was writing an article comparing the output quality of the Apple codec and x264 codecs, and wanted to post the encoded files to the web in a Flash Player. I encoded all files in Compressor, ending up with QuickTime files with the MOV extension.
I was using Adobe Flash Catalyst CS5 to create the web pages, and though the files were Flash-legal H.264, Flash Catalyst wouldn’t load them, just FLV, F4V and .MP3 files. I changed the file extensions to F4V and the program loaded three of the four. I checked the recalcitrant file in MediaInfo and discovered that it was encoded with a compressed header. I re-encoded using None in the Streaming list box, and the file loaded fine.
Here’s what I think happened. According to this blog post, Flash Player doesn’t look at the file extension to decide whether it can play a file; rather, as noted in the blog post, “the Flash Player always looks inside the file to determine what type of file it is.” Apparently, Flash Catalyst does look at the extension, which is why I had to change from MOV to FV4. However, once inserted into Flash Catalyst, the compressed header prevented the Flash component from figuring out what kind of file it was, so it didn’t work. No compressed header, and the file loaded fine.
Encountering the MOOV Atom
I then created the web pages and uploaded them. When I tried to play the videos, however, they wouldn’t play until fully downloaded. After a few moments, I realized that I had encountered the dreaded moov atom issue. Here’s a quick summary from http://lists.apple.com/archives/quicktime-talk/2000/Dec/msg00044.html:
A QuickTime movie file contains information about the movie, stored in a ‘moov’ atom — which contains one ‘trak’ atom for each track in the movie, a ‘udat’ atom for user data, and so on. This information tells QuickTime what’s actually in the movie and where it’s stored.
QuickTime needs to load the ‘moov’ atom into the computer’s memory in order to play a movie. When you save a self-contained fast-start movie, QuickTime puts the ‘moov’ atom at the front of the file (it’s usually only 1 or 2 Kbytes), followed by the movie data, arranged in chronological order. When you download the file over the Internet, the ‘moov’ atom arrives right away, so QuickTime can play the movie data as it comes in over the net.
If the ‘moov’ atom is at the end of the file, QuickTime doesn’t know what’s in the movie or where it’s stored, so it doesn’t know what to do with the movie data as it comes in, and the movie can’t play until the ‘moov’ atom arrives at the end of the file.
Though the blog post refers to the QuickTime Player, the Flash Player needs the moov atom to start playing as well. So, when encoding with Compressor, you have to use the Fast Start option to make sure the moov atom is at the start of the movie. But if you use Fast Start – Compressed Header, the Flash Player probably won’t play it. So use the Fast Start option as shown below.
What to do if you have a file with the moov atom at the back of the file? Well, you can re-encode the file selecting the Fast Start option, or, download the QTIndexSwapper from http://renaun.com/blog/code/qtindexswapper/. It’s a free Adobe Air application that analyzes the file, determines if the header is in the right place and corrects the problem if necessary.
Once you install the application and get it up and running, click File or Folder to add single or multiple files, then click Process. Only takes a few moments per file, and once you reupload your files, they should start to play after only a few moments of buffering.
Note that if you’re streaming via the Flash Media Server, Wowza server or other server, the communication between server and Player should allow the player to play the file immediately, even if the moov atom isn’t up front. As far as I know, the moov atom issue is only a problem for progressive download. If you’re encoding for one of these servers, I’m guessing that you should still use the Fast Start option, but check with your streaming server administrator.
If you’re producing H.264 MOV files in Compressor or similar tool, make sure that you select the Fast Start option without the compressed header. If you do, you can change the MOV file extension to F4V or FLV if necessary for your web authoring tool, and the file should play just fine. Note that you don’t have to change the extension for the file to play in the Flash Player, but you probably will to import the file into Flash or Flash Catalyst.
If you have video file that won’t start to play in the Flash (or QuickTime) Player without fully downloading, it’s probably a moov atom issue, and you should definitely try the QTIndexSwapper utility to correct it. It’s free, fast and worked like a charm for me.