mercoledì, marzo 26, 2008

Problem and Solution: Progressive FLVs in H.264

I just ran across an interesting blog entry at scottmorgan.com that explains an issue that can occur in H.264 files being downloaded progressively. Amazingly one of the solutions Scott discovers is an AIR application!

Problem:

“…I ran into an issue yesterday with progressively downloaded H.264 video. The video would play but it was not progressively downloading, it would download the entire file before it began playing…the files played fine in Quicktime, and they played fine in Flash when streamed from FMS 3, just not progressively.”

“the problem lies within the encoding of the file and where the ‘moov atom’ is stored. The moov atom is essentially the header information of the file. To progressively play a file this data is needed before the first frame of video can play. This data contains the appropriate meta data the NetStream class looks at when determining the length, size, etc of the video. The moov data in my .mov files were stored at the end of my videos and that is why the video wouldn’t play until the entire file was downloaded. The moov data needs to be at the beginning of the file in order to progressively stream video.”

Solution:

“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 created a simple batch and saved out all my progressive videos using Quicktime.”