Best Practices for Windows Media Encoding
General Parameters
Data Rate
Probably the most critical parameter for any WMV file is its data rate. This determines how big the file is, and how much bandwidth a user would need to stream it. By default, Windows Media measures data rate in kilobits per second (Kbps). To figure out how big a file at a particular data rate is going to be, use this simple equation: the size in KB equals the data rate (in Kbps) divided by 8 times the duration in seconds. The "8" is in there as data rate is in kilobits per second, but file size is in kilobytes per second. I use "b" for bits and "B" for bytes as shorthand.
Note that Windows Media, like most streaming platforms, uses the correct base-10 metric values for K, M, and B, not the base-two derived values often but erroneously used for shorthand in computing.
To correctly predict the file size, note that you’re calculating accuarate KB sizes, while most operating systems list file sizes in KiB/MiB/GiB by default. To get the real value, see the file’s Properties and look at the value in bytes.
Peak Buffer Size
The buffer-size parameter is available for all bit rate-limited modes. It specifies the duration (in seconds) of the window over which average (for CBR) or peak (for VBR) bit rate is calculated. Bigger buffers can provide more efficient encoding, but make hardware decode more complex and increase latency. For real-time streaming, the maximum startup and random access latency can go up by up to a second for each additional second of buffer.
Peak Bit Rate
Only used in bit rate VBR (peak), the peak bit rate value indicates the maximum bit rate during the peak. Higher values improve the quality of difficult sequences, but also increase the complexity of the decode. A simple way to determine appropriate bit rate is to encode in CBR with the same parameters, and find the highest data rate that will play back reliably. You can then use that as the peak bit rate.
Keyframe Interval
Keyframe interval determines the maximum time between keyframes. A keyframe (also called an I-Frame, for independent or intra frame) is a fully self-contained frame with no other frame based on it. These are the only frames that can be immediately jumped to in random access.
More frequent keyframes make random access, like scrubbing through a file or startup for a streaming file, faster. However, they also reduce efficiency, since a typical keyframe needs more bits to provide equivalent quality compared to normal frames.
Note that the codec will insert additional keyframes as needed throughout the file, at points where the video changes dramatically.
Quality
The quality parameter used in the CBR and 1-pass (quality) VBR modes controls the target quality for the video. In quality VBR, it simply controls the quality of each frame, and hence how many bits it gets relative to its difficulty—higher values look better, but take a lot more bits.
In CBR, it controls emphasis on spatial versus temporal quality, essentially setting a minimum bar on frame quality. Lower values let the quality of video frames drop as low as needed in order to hit the target data rate without dropping frames. Higher values set a higher minimum frame quality, and the codec will drop frames on encoding in order to ensure the target bit rate and quality targets are maintained.Using low quality settings can result in poorer video quality, even when the video is in no danger of dropping frames. This is because the codec doesn’t always perfectly adapt to future changes in the video. In general, for most content you want to find the highest value that doesn’t drop frames. The v11 codecs, especially if you’re using the new registry key settings, can be a lot more efficient than previous iterations, so you can use a higher quality value with the same source and settings than before. I think 75Kbps is a good starting value for most web video now. If you’re using Windows Media Encoder, it’ll report after the encode if there were any dropped frames, a handy way of seeing if you’re using too high a setting. WME also provides reasonable defaults to start with.
Encoder Complexity
Encoder complexity controls how hard the encoder works to encode the video. There are six levels in the v11 codecs with about an eight-fold difference in encoding speed from slowest to fastest, and about a 20% improvement in compression efficiency from fastest to best (which actually isn’t the slowest). Different tools present the option in different ways. In Windows Media Encoder, it is set in Tools > Options > Performance.
For optimal quality, the second-to-slowest mode (listed as "4" or "80" in some tools, and second last to the left in WME) is almost always the best choice. The slowest mode is a lot slower and very rarely produces any measurable improvement in quality.
Intelligent Streaming
Intelligent Streaming is Microsoft’s name for our multiple bit rate (MBR) encoding system. The idea behind MBR is to provide content in multiple bit rates in a single file in order to provide scalability in streaming. Then the player and Windows Media Services (WMS) cooperate to determine the highest data rate version of the video and audio that will fit within the available bandwidth.
Intelligent Streaming is only available when doing real-time streaming from WMS with Windows 2003 Server. Files that won’t be coming off WMS should not be encoded with Intelligent Streaming, since it’ll just make the files larger, but won’t provide any added functionality. Also, not all clients support Intelligent Streaming. It works best when targeting WMP 9 or higher running on Windows.
Tuning for the Target Player
Windows Media Player 11
Windows Media Player 11 is the newest version of WMP. It’s available as a free download for Windows XP and built into Windows Vista. With WMP, you can safely use both WMV 9 Advanced profile and WMA 10 Pro’s LBR modes.
Windows Media Players 9 and 10
WMP 9 is a good baseline target for mass-market WMV delivery today. WMP 9 is preinstalled with the widely deployed Windows XP Service Pack 2, and it is available via Windows update all the way back to Windows 98. WMP 9 established much of the modern infrastructure for Windows Media, and it’s functionally equivalent to WMP 11 for almost all web video. It can safely use WMV 9 and all the WMA 9 audio codecs. WMP 10 was a fine release, but was focused more on performance and media management, and didn’t add much functionality specific to web video.
Windows Media Players 6, 7, and XP
Older versions of WMP can use WMV 9 and WMA 9 using codec updates (either automatically downloaded, or via an enterprise deployment). However, none of the pre-WMP 9 versions support the full Intelligent Streaming model implemented in the current version of WMS, and hence can only switch between video tracks of the same frame size, and not at all between audio tracks. WMP 6.4 (the last version for Windows NT 4.0) also isn’t reliable with VBR-encoded content.
Flip4Mac
Telestream’s Flip4Mac is Microsoft’s current recommended solution for Windows Media playback on the Mac.
Flip4Mac handles WMV 9 and WMA 9 and WMA 9 Pro very well, but doesn’t currently support WMV 9 Advanced Profile or the other audio codecs. Telestream also offers professional versions of Flip4Mac that support importing WMV into Mac tools like Final Cut Pro and After Effects, and exporting to WMV in QuickTime Pro as well.WMP 9.1 for Mac
While development has ende