Back to Basics: H.264 Transcoding for Flash
I caught up with Fabio Sonnati earlier this week. Sonnati, who runs a very good blog on H.264 and Flash encoding, is a consultant with Progetto Sinergia, a team of consultants focused on Flash Media servers, media applications and encoding.
Progetto Sinergia works with a number of ICT consultancy teams, and also collaborates with Adobe and several smaller United States and European clients, some of which have contact him directly after viewing his blogs or articles at locations such as Adobe Developer Network.
Sonnati hosted a session that dealt with concepts for H.264 transcoding.
"Use VP6 as a fall-back strategy," said Sonnati, "to cover 99% of the audience, since H.264 can be viewed by 90% of the audience (that have Flash Player 9 v3 or Flash Player 10)."
Sonnati then discussed the main H.264 encoders, including QuickTime, Main Concept’s Reference, Adobe Media Encoder CS4, and Sorenson Squeeze, as well as the various profiles (Baseline, Main, High and High 10).
While he has written his own encoder, his session used examples from Main Concept’s Reference encoding tool since this is the encoder used in Adobe Media Encoder CS4 as well as the Flash Media Encoding Server (which is a branded version of Rhozet Carbon Coder that itself uses the Main Concept H.264 encoder).
Here are a variety of the tips he offered:
• Variable bit rate encoding. While Sonnati noted in general that variable bitrate encoding is bad for streaming and good for progressive download, he noted in a discussion afterwards that the approach of FMS 3.5 could be beneficial. He also said that variable bitrate could still work for progressive downloads with bandwidth throttling, as the peak or spike in a variable-bitrate progressive download would be no higher than the desired bandwidth, while the bandwidth throttling would typically be set at 15-20 per cent above the intended playback bandwidth of the progressive download.
• Multi-pass encoding. When asked about 3-pass versus 2-pass encoding, Sonnati mentioned that 3 pass encoding requires 50 per cent more processing time but yields only a few per cent quality gain over 2 pass encoding.
• Entropy encoding. Sonnati claimed that Context Adaptive Binary Arithmetic Coding (CABAC) is best quality choice, yielding a 5-7% additional quality benefit, but warned that it also requires higher decoding processing. He suggested use of the Hadamard transform if available, too, for intra-frame prediction.
For CAVLC entropy encoding, he mentioned it requires lower processing power but does not provides the quality benefits of CABAC.
• Keyframes. For reference frames, H.264 supports up to 16 reference frames, but the encoding time also rises, so Sonnati suggested sticking to 2-5 reference frames.