1
votes

Hi I am new to UWP programming. We have an existing video call application, which we are porting for Windows in UWP. Our existing system designed such a way that, camera raw frames (YUV frames) feed to video encoder(H.264 OR H.263) and encoded video data will be packetized and sent to network.

To get YUV camera data, I am using MediaCapture and MediaFrameReader as explained in https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/process-media-frames-with-mediaframereader

But, I am not able to find API's , to encode these video frames and get encoded video frames.

Please help me, how can I get encoded video frames in UWP

1

1 Answers

0
votes

I'm almost sure that you can't do this in C#. I haven't been current with media stuff lately, but as of a few years ago, you had to do all of the video conversion stuff using Media Foundation (MF) in C++.

Media Foundation Programming Guide

I tried (and only half-succeeded) to make an MKV codec back when one didn't exist and that's what I had to turn to. These codecs are basically black boxes and MF will automatically pick the codec required for decoding video.

For writing your own codec (or making an existing codec work with MF), you'll have to turn to this tutorial. The problem is it uses WRL instead of the newer C++/WinRT. But oh, well.

Also, if you want to see my terrible attempt to make an MKV codec, go take a look here: https://github.com/limefrogyank/MKVSource I was/am a novice at C++ and a complete noob at MF, too. But it worked... kind of.

Edited Feb 2, 2019

Just to be sure, have you seen this? Apparently, you can transcode video much more easily now using built-in tools: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/MediaTranscoding

But to incorporate your own codec, you can follow this tutorial to combine something you create using MF with UWP. https://docs.microsoft.com/en-us/cpp/windows/wrl/walkthrough-creating-a-windows-store-app-using-wrl-and-media-foundation?view=vs-2017