Problem with BeginWriting API when using MFVideoFormat_H264 & MFMediaType_Video

Skip to first unread message


Aug 23, 2011, 10:55:55 AM8/23/11

I have been trying to write an ASF file using encoded H264 video data
using Microsoft Windows Media Format SDK. I am asking this question in
Media Foundation because I could not see a forum which displays as the
one for Media Format SDK. Apart from that, I am using bits and pieces
of MediaFoundation Framework as well. Here is my problem:

When trying to complete all the steps mentioned in this link : , I am
using MFVideoFormat_H264 as the subtype and MFMediaType_Video for
setting in the Type information as mentioned in Step 3.1 in the above
link. I am using them because I could not find any format for H264 in
Windows Media Format SDK. However, I have installed Windows SDK and
Visual Studio 2010 in my system. I have ensured that the required
video encoder for MFVideoFormat_H264(mfh264enc.dll) is installed in
the system using regedit and also I have ensured that the appropriate
library (mfuuid.lib) is included in my project. But , after having
done all this, when I try to run the code to write the frames into the
file, the BeginWriting function call fails and gives the error

But when I create some custom random subtype using GUIDGenerator and
used that in my subtype information and type as WMMediaType_Video, the
call succeeds but ultimately, the codec subtype which I have specified
is invalid and hence the file is not playable at all. Now, what do I
need to do in order to make the BeginWriting succeed with the correct
codec type. One more thing to note is that all my frames are
supposedly getting written properly into the file if I use the custom

Please let me know if you have any questions. I look forward getting
an answer and thanks a lot for the help!

Ramkumar PS

Reply all
Reply to author
0 new messages