locked
How can I encode YUV frames and output an H264 stream? RRS feed

  • Question

  • So I would like to take in YUV frames, encode them into H264 format (hardware accelerated) and stream them somewhere.

    I've spent a couple days looking at the Microsoft Media Foundation and can't figure out how to just take in a single YUV frame at a time or get started.

    Been looking through the MSDN documentation as well as "Developing Microsoft Media Foundation Applications" from O'Reilly Media.  Just don't know where to get started coding thing, probably something basic I'm missing.

    -Matt

    Friday, November 15, 2013 7:29 PM

All replies

  • One way to do it, but writing it to file, not streaming it to network: Initialize Media Sink (for ex. get IMFSinkWriter using MFCreateSinkWriterFromURL), then define its input media type to be whatever YUV format you are using. Then add H264 stream to it as output (AddStream). You feed the frames to sink using WriteSample method.

    This way you'll get H.264 output to file.

    If you want to stream to network, then you have to create your own Network Media Sink, because AFAIK the network sink in Media Foundation only supports ASF payload.



    Saturday, November 16, 2013 11:51 AM