H.264 encoder perhaps not working (win7) RRS feed

  • Question

  • I may be having H.264 encoder problems too, but at a much more fundamental level.

    In my source reader / sink writer model program, I am using the H.264 IMFTransform directly as suggested in some other post somewhere.  I then send the samples it produces out to the network (using cobbled live555 library code to VLC media player).  

    When I watch this network stream, the video quality is really bad; so bad that it seems like I must be doing something wrong.

    Since I had to cobble together a live555 method to send out the network via RTSP, I can't be sure if my problem is that this is corrupting or dropping compressed frames, or if the compressed frames coming out of the H.264 IMFTransform are the problem.  So I want to divide and conquer by first testing my H.264 IMFTransform out.  Now I start having problems that stop me from moving forward.

    1) I was already forking the stream off to a file using an IMFSinkWriter.  This works.  I rearranged some code to use an IMFSinkWriter that takes H.264 encoded frames (subtype=MFVideoFormat_H264) as input rather than the uncompressed NV12 frame (subtype=MFVideoFormat_NV12) that went into the encoder.  However I get back MF_E_INVALIDMEDIATYPE from SetInputMediaType().  So it seems that I can't do this.  Is there another [easy] way to wrap these encoded frames up and write them to a .mp4 file, so that I can later play this file back and see if my original H.264 encoding is good or bad?

    2) Alternatively, I tried immediately decoding the H.264 that I had just encoded.  But my build link fails because CLSID_CMSH264DecoderMFT is missing (used by CoCreateInstance() per http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815(v=vs.85).aspx).  It seems it's "declared" as extern in wmcodecdsp.h so that my source "compiles", but the "link" fails because it's no where actually "defined".  Where or how to I get CLSID_CMSH264DecoderMFT ?

    Thanks in advance for your assistance.

    Friday, January 4, 2013 7:02 PM

All replies

  • Hello

    I believe that you doing something wrong. I recently developed MJPEG source and used H264 encoder to produce ASF video files. Result was really good. Actually bit rate is very important and affects on quality. Also we have RTSP source and decoded from H264 also looks nice. Something wrong with your encoder settings



    Wednesday, January 9, 2013 6:53 PM
  • 1) You can't set H.264 as the input type is using MFCreateMPEG4MediaSink because MF will always insert an encoder into the media sink. This means you MUST use uncompressed video supported by the H.264 encoder. How are you creating your media/file sink? You can write encoded frames directly to a File Sink using MFCreateSinkWriterFromURL, adding and configuring the video stream then calling BeginWriting().

    2) Try taking the CLSID_ off the front of CLSID_CMSH264DecoderMFT

    • Proposed as answer by Nobby_ Sunday, January 13, 2013 9:28 PM
    Sunday, January 13, 2013 9:27 PM