When you try to play back a video file or an audio file that is encoded with the H.264 video format or the AAC audio format, playback fails. Note This problem may be encountered by Windows Media Player, by Windows Internet Explorer 9.0, or by other applications that rely on the Windows Media platform to play media files that use these formats.
The best codec pack for Windows 7 should allow you to seamlessly play all sorts of audio and video formats without having any worry lines appear on your brow. X264, divx, h.264, aac, mp3, mp4. The a major updated VLC 2.0.4 introduces an important number of fixes and improvements especially for Blu-Ray under Windows 7. However, for legal reasons, AACS and BD+ DRM libraries and keys still are not shipped. To make Windows Media Player play AAC files, you can download and install the Windows Player Codec Pack. Windows Player Codec Pack is an inclusive codec pack which gives your computer the ability to play various media files. It’s 44.3mb big in size and includes tons of media file supports. Codec Properties. The H.264 encoder implements the ICodecAPI interface for setting encoding parameters. It supports the following properties. For the codec requirements for HCK encoder certification, see the Certified Hardware Encoder section below. The following properties are supported in Windows 7.
-->The Microsoft Media Foundation H.264 video encoder is a Media Foundation transform that supports the following H.264 profiles:
- Baseline Profile
- Main Profile
- High profile (requires Windows 8)
The H.264 video encoder exposes the following interfaces:
Input Types
The input media type must have one of the following subtypes:
- MFVideoFormat_I420
- MFVideoFormat_IYUV
- MFVideoFormat_NV12
- MFVideoFormat_YUY2
- MFVideoFormat_YV12
For more information about these subtypes, see Video Subtype GUIDs.
The output type must be set before the input type. Until the output type is set, the encoder's IMFTransform::SetInputType method returns MF_E_TRANSFORM_TYPE_NOT_SET.
Output Types
The encoder supports a single output subtype:
- MFVideoFormat_H264
Set the following attributes on the output media type.
Attribute | Description |
---|---|
MF_MT_MAJOR_TYPE | Major type. Must be MFMediaType_Video. |
MF_MT_SUBTYPE | Video subtype. Must be MFVideoFormat_H264. |
MF_MT_AVG_BITRATE | Average encoded bit rate, in bits per second. Must be greater than zero. |
MF_MT_FRAME_RATE | Frame rate. |
MF_MT_FRAME_SIZE | Frame size. |
MF_MT_INTERLACE_MODE | Interlace mode. |
MF_MT_MPEG2_PROFILE | H.264 encoding profile. The supported values are:
|
MF_MT_MPEG2_LEVEL | Optional. Specifies the H.264 encoding level. The default value is –1, indicating that the encoder will select the encoding level. It is recommended not to set the level in the media type, and allow the encoder to select the level. The encoder can derive the proper level for a given video stream, taking into account the format constraints and the characteristics of the video. For more information about profile and level constraints, refer to Annex A of ITU-T H.264. |
MF_MT_PIXEL_ASPECT_RATIO | Optional. Specifies the pixel aspect ratio. The default value is 1:1. |
After the output type is set, the video encoder updates the type by adding the MF_MT_MPEG_SEQUENCE_HEADER attribute. This attribute contains the sequence header.
Codec Properties
The H.264 encoder implements the ICodecAPI interface for setting encoding parameters. It supports the following properties.
For the codec requirements for HCK encoder certification, see the Certified Hardware Encoder section below.
The following properties are supported in Windows 7.
Property | Description |
---|---|
CODECAPI_AVEncCommonRateControlMode | Sets the rate control mode. See Remarks. The default mode is unconstrained variable bit rate (VBR). |
CODECAPI_AVEncCommonQuality | Sets the quality level. This property applies when the rate control mode is quality-based VBR (eAVEncCommonRateControlMode_Quality). The valid range is 1–100. The default value is 70. To set this parameter, set the property before calling IMFTransform::SetOutputType. To set this parameter in Windows 7, set the property before calling IMFTransform::SetOutputType. The encoder ignores changes after the output type is set. In Windows 8, this property can be set at any time during encoding. Changes are applied starting at the next input frame. Internally, the encoder converts this property to an AVEncVideoEncodeQP value. |
The following properties require Windows 8.
Property | Description |
---|---|
CODECAPI_AVEncAdaptiveMode | Sets the adaptive encoding mode. The H.264 encoder supports the following modes in Windows 8:
|
CODECAPI_AVEncCommonBufferSize | Sets the buffer size, in bytes, for constant bit rate (CBR) encoding. The valid range is [1 ... 2³²–1]. Requires Windows 8. |
CODECAPI_AVEncCommonMaxBitRate | For constrained VBR encoding, specifies the rate at which the 'leaky bucket' is drained, in bits per second. This property applies when the rate control mode is eAVEncCommonRateControlMode_PeakConstrainedVBR. The valid range is [1 ... 2³²–1]. |
CODECAPI_AVEncCommonMeanBitRate | Sets the average bit rate for the encoded bit stream, in bits per second. This property is ignored if the rate control mode is eAVEncCommonRateControlMode_Quality. The valid range is [1 ... 2³²–1]. In CBR and unconstrained VBR modes, the average bit rate determines the final size of the file. In CBR mode, the average bit rate is also the rate at which compressed bits are drained from the 'leaky bucket.' (For more information, see The Leaky Bucket Buffer Model.) In Windows 7, the average bit rate is specified by the MF_MT_AVG_BITRATE attribute on the media type. In Windows 8, you can set the average bit rate using either the MF_MT_AVG_BITRATE attribute or the CODECAPI_AVEncCommonMeanBitRate property. If both are set, CODECAPI_AVEncCommonMeanBitRate overrides. In Windows 8, you can set the average bit rate during encoding. If the bit rate changes, the encoder uses adaptive encoding. |
CODECAPI_AVEncCommonQualityVsSpeed | Sets the quality/speed tradeoff. Valid range:
This value affects how the encoder performs various encoding operations, such as motion compensation. At higher complexity levels, the encoder runs more slowly but produces better quality at the same bit rate. |
CODECAPI_AVEncH264CABACEnable | Enables or disables CABAC (context-adaptive binary arithmetic coding) for H.264 entropy coding. The default value is VARIANT_FALSE. CABAC is not used for Baseline profile. |
CODECAPI_AVEncH264SPSID | Sets the value of seq_parameter_set_id in the SPS NAL unit of the H.264 bitstream. |
CODECAPI_AVEncMPVDefaultBPictureCount | Sets the maximum number of consecutive B frames in the output bitstream. Valid values are:
For Baseline profile, the number of B frames is always zero. The encoder will override nonzero values. For other H.264 profiles, if this property is nonzero, the encoding pattern is IBBPBBP, where the maximum number of consecutive B frames is equal to CODECAPI_AVEncMPVDefaultBPictureCount. |
CODECAPI_AVEncMPVGOPSize | Sets the number of pictures from one GOP header to the next, including the leading anchor but not the following one. The valid range is [0 ... 2³²–1]. If zero, the encoder selects the GOP size. The default value is zero. |
CODECAPI_AVEncNumWorkerThreads | Sets the number of worker threads used by a encoder. The valid range is 0–16. If zero, the encoder selects the number of threads. |
CODECAPI_AVEncVideoContentType | Indicates the type of video content. |
CODECAPI_AVEncVideoEncodeQP | Valid range: 16–51. The default value is 24. This property applies when the rate control mode is eAVEncCommonRateControlMode_Quality. This property configures the same encoding setting as AVEncCommonQuality. However, AVEncVideoEncodeQP enables the application to specify the value of QP directly. If both properties are set, AVEncVideoEncodeQP overrides. The default value of 24 corresponds to the default value of 70 for the AVEncCommonQuality setting. |
CODECAPI_AVEncVideoForceKeyFrame | Forces the encoder to code the next frame as a key frame. |
CODECAPI_AVEncVideoMinQP | Valid range: 0–51. The default value is 0. This property applies to all rate control modes. The encoder should not produce a QP value lower than what is specified by the CODECAPI_AVEncVideoMinQP property. |
CODECAPI_AVLowLatencyMode | Enables or disables low-latency mode. See 'Multithreading' in the Remarks section. |
Remarks
The encoder supports the following rate control modes.
Mode | Constant | Description |
---|---|---|
Constant bit rate (CBR) | eAVEncCommonRateControlMode_CBR | The encoder tries to achieve a constant bit rate, using a 'leaky bucket' model. The target bit rate is given by the CODECAPI_AVEncCommonMeanBitRate property. Requires Windows 8. |
Constrained variable bit rate (VBR) | eAVEncCommonRateControlMode_PeakConstrainedVBR | The encoder uses a 'leaky bucket' model with a peak bit rate. The drain rate for the leaky bucket is given by the CODECAPI_AVEncCommonMaxBitRate property. Requires Windows 8. |
Quality-based variable bit rate (VBR) | eAVEncCommonRateControlMode_Quality | The encoder tries to achieve a constant quality level, given by the AVEncCommonQuality property. |
Unconstrained VBR | eAVEncCommonRateControlMode_UnconstrainedVBR | The encoder tries to achieve the target bitrate given by the MF_MT_AVG_BITRATE attribute in the output media type. This is the default mode. |
CBR and constrained VBR modes require Windows 8.
In Windows 8, the encoder sets the following attributes on the output samples:
Note
A previous version of the documentation incorrectly stated that the encoder is supported on Windows Server 2008 R2.
Multithreading
In Windows 8, the encoder supports two encoding modes:
- Slice encoding. In this mode, slices are encoded in parallel. Each slice is encoded on a different thread. This mode has low latency, because a single picture is encoded in parallel. However, this approach does not scale as the number of cores increases, because the number of slices is bounded by the number of macroblock rows in the input picture.
- Multi-frame encoding. In this mode, the encoder accepts multiple frames of input and encodes them in parallel. This mode scales better in a multicore environment, but introduces more latency.
The encoder defaults to slice encoding, to minimize latency. To enable multi-frame encoding, set the CODECAPI_AVLowLatencyMode property to VARIANT_FALSE.
To set the number of worker threads used by the encoder, set the CODECAPI_AVEncNumWorkerThreads property.
In Windows 7, the encoder always uses slice encoding.
Certified Hardware Encoder
If a certified hardware encoder is present, it will generally be used instead of the inbox system encoder for Media Foundation related scenarios. Certified encoders are required to support a certain set of ICodecAPI properties and can optionally support another set of properties. The certification process should guarantee that the required properties are properly supported and, if an optional property is supported, that it is also properly supported.
The following is the set of required and optional ICodecAPI properties for encoders to pass the HCK encoder certification.
The following Windows 8 and Windows 8.1 ICodecAPI properties are required:
The following Windows 8.1 ICodecAPI properties are optional, but are tested in HCK if supported.
- CODECAPI_AVEncVideoTemporalLayerCount (Dynamic)
The following Windows 8 and Windows 8.1 ICodecAPI properties are optional, but are tested in HCK if supported.
- CODECAPI_AVEncVideoTemporalLayerCount (Static)
The following ICodecAPI properties are optional. They are not tested in HCK.
Requirements
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | None supported |
DLL |
|
See also
Sometimes when you try to play a video file in a player like Windows Media Player, you might receive an error that the file cannot be played, or a codec is not installed on your system. In fact, a number of audio and video playback issues can often be caused by not having the correct codec installed on your computer, a problem with the installed codec, or even the wrong version installed.
If you’re wondering what a codec is, it’s most commonly made up from the 2 words Coder-Decoder, and is simply a device or a small piece of software that can encode or decode a piece of data, in our case audio or video data. If for example you download a movie clip from the internet, your media player has to have access to the same decoder that it was encoded in. Sometimes if you were to ask a less experienced person if they have a certain codec installed to be able to play a file, most users would not be able to tell you easily.
Finding this information can be quite difficult for an average home user, but there are ways to get it, some easy and some a little more difficult. Here we’ll provide the manual way of finding your installed codecs through Windows, and also some automatic ways through 3rd party software to help determine what video and audio codecs are installed.
1. Find Your Codecs with SherlockA program to give you some useful information about your computer’s installed codecs is Sherlock – The Codec Detective! Everything is listed in the single window and you can easily see information about the codec, it’s associated driver file, version, date and description. Sherlock is a tiny portable executable file of around 80K meaning no installation is required. When you run The Codec Detective it will first scan for installed codecs and list in a window any that appear to have problems. When you get to the main interface these “broken” codecs will be displayed in red.
You can easily switch between audio and video codecs by selecting from the drop down in the top left of the window. There is also an option to export the data about all the installed codecs to a text file which is handy if information about what’s installed needs to be sent to somebody to troubleshoot or determine if the correct files are installed. The program has been tested and works on Windows XP to Windows 7.
Download SHERLOCK – The Codec Detective
2. Using Nirsoft InstalledCodec
Nir Sofer of Nirsoft is known for producing simple and effective little utilities, and InstalledCodec is yet another one that does exactly what it’s designed to do. In addition to the audio and video codecs present on the system, it can also display the DirectShow filters, and a valuable function for users of a 64-bit Windows is the ability to display the relevant 64-bit codecs and filters. Any missing or problem codecs will show in pink in the main window.
Aac Codec Windows
Each entry has a lot of information displayed on its line including names, descriptions, locations, sizes and also the merit of the codec, which is the priority at which each codec is given over other compatible codecs for a particular format. Another useful option, although not something the novice should play around with unless guided by someone more experienced is the ability to enable or disable anything in the list, ideal for troubleshooting problem codecs. InstalledCodec is a portable program and works on Windows 2000 to Windows 7.
Download InstalledCodec
3. Codec Information Through Windows
One way of checking is through any version of Windows Media Player although the button link is in rather a hidden away location. Open windows Media Player and if you don’t have a toolbar menu visible right click towards the top of the program to bring up the context menu. Go to Help -> About Windows Media Player, then click on the Technical Support Information link at the bottom. This will open a webpage that lists several bits of information including installed audio and video codecs.
There is also the MSInof32 built in Windows utility which can display codec information, but it doesn’t display all those installed and only seems to list pretty much the defaults installed by Microsoft.
Windows XP users also have a rather basic option to display the names of installed codecs by going to Control Panel -> Sounds and Audio Devices -> Hardware tab. Now click on either Video or Audio codecs in the window and click the Properties button.
Click on the Properties tab to be presented with a list of the desired codecs. Double clicking an audio codec will give you a few options such as changing its priority and disabling it altogether.