Blog
H.264 + AAC for Quicktime
Date: 16/10/2007
Today I was developing a mp4 encode path for my private stock VidEnc application which takes mpeg2 from Digital TV and re-encodes it. It has for a long time supported mpeg2 to xvid/avi via besweet and mencoder. But mencoder has a problem on longer videos where it drops the first 'n' frames, somewhere between 1 and 6 seconds of video. I could never figure this out so I just print out the "offset" to remux the A/V in VirtualDub. A right pain I can tell you.

So after using Handbrake a lot I decided that the pain of developing a new video pipeline would be offset by the better quality of H.264 and the smaller filesizes. So today I had some time and got into it. Things went fairly smoothly until I got my output mp4 file, and it wouldn't play in Quicktime.

This, as I'm finding out, is not unusual because Quicktime7 doesn't fully support H.264, just a subset of it. Anyway that wasn't what was causing this: "Error -50: An unknown error has occured" when I tried to open the file. My pipeline as it stands is:
  • Mpeg2 -> Pvastrumento -> separate a/v
  • Audio -> besweet to wav -> faac to aac
  • Video -> x264 to mp4
  • Mp4box to mux the A/V back together


I now know that I can do the Audio -> aac in one step using Besweet, but I havn't gotten around to fixing it yet. However there are a few gotchas in creating suitable mp4 files for QT7.
  • The AAC audio must be of the type MPEG4, rather than MPEG2. The faac option is "-w" to do that.
  • x264 should output to .mp4, not .264
  • Don't go higher then "--bframes 2" for x264.
  • Don't use "--b-pyramid" for x264 either.
This should give you a playable mp4.

Should...
 
Reply
From:
Email (optional): (Will be HTML encoded to evade harvesting)
Message:
 
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.
BBcode:
[q]text[/q]
[url=link]description[/url]
[img]url_to_image[/img]
[pre]some_code[/pre]
[b]bold_text[/b]