How to encode a commonly usable (Quicktime (7) compatible) MPEG-4 video (mp4 container, avc video, aac audio).

Survey

What if I take a survey of what others think, then learn about their differences for understanding and opimization?

Quicktime 7 Parameters

B-frames <= 1 [1]

b_pyramid and weight_b will have no effect, since they require bframes to be greater than 1. [1]

No 8x8 DCT macroblocks [1]

This also means that the i8x8 option will have no effect, since it requires 8x8dct. [1]

SAR = 1 [1]

Does not support SAR (sample aspect ratio) information in MPEG-4 files; it assumes that SAR=1. [1]

MPEG-4 AAC

AAC was defined in both MPEG-2 and MPEG-4, and Quicktime wants the 4 version.

  1. 14.7. Using MEncoder to create QuickTime-compatible files

mencoder

Example

mencoder source -o </dev/null | output.avi> \ -ovc x264 -x264encopts pass=<1 | 2>:<turbo | >:bitrate=bitrate:frameref=5:bframes=1:\ me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 \ -vf harddup \ -oac faac -faacopts br=bitrate:mpeg=4:object=2 -channels channels -srate sampleRate

First Try

Here's what I came up with on 2007-04-05.

ffmpeg \ -i export001.dv \ -cropleft 8 -cropright 8 -s 320x240 -aspect 4:3 \ -vcodec h264 -crf 25 \ -subq 7 -refs 12 -me umh \ -partitions +partb8x8+partp8x8+partp4x4+parti4x4 -bf 1 -trellis 2 -keyint_min 300 \ -i audio2m16.wav \ -acodec aac -aq 50 \ ffmpegmplayersettings1.mp4 \ -map 0:0 -map 1:0 \ -f mp4 \ -title "Sonogram Barker 2007-04-03"

And then MP4Box ffmpegmlayersettings1.mp4 --out final.mp4 -inter 0.5 to interleave the a/v for streaming (start playing before a download is complete).