Microsoft Media Foundation 中的网络媒体接收器

Network media sink in Microsoft Media Foundation

这里写了如何使用Media Foundation中的网络媒体源接收视频流:https://msdn.microsoft.com/en-us/library/windows/desktop/aa369734(v=vs.85).aspx。但是如何使用这个库以简单的方式通过网络发送视频流呢?是否有网络媒体接收器或类似的东西?我的意思是我有一台服务器,只是想将视频流式传输到连接的客户端。

没有通过 Media Foundation 接收器流式传输视频的简单方法,因为它没有实现网络流式传输协议。但是,有两个接收器可用于此目的 - ASF 和 MP4。 ASF 格式是 Microsoft 格式,它可用于在 Microsoft 平台 MFCreateASFStreamingMediaSink - it needs class object withIMFByteStreaminterface as argument - It is possible capture ASF byte pockets from sink and send over any network protocol. MP4 format is more common at the present time for video and it can be used for video streaming for almost all computer platforms. Media Foundation includes two versions of MP4 formats - with media info at the end file and with media info at the begin file - yes these formats is used for writing video into the files, but if you search sink for fragmented format - with media info at the begin MFCreateFMPEG4MediaSink - you will see that it also needs class object withIMFByteStreaminterface as argument - it is possible get byte pockets of MP4 format for streaming. Of course, video format protocol is not enough for steaming - it needs write streaming protocols around of byte pockets. However, in the simple way MP4 fragmented format can be played via HTML5 via MP4 player element by direct calling. A couple months ago, I wrote such simple server - it has listened connecting, and after receiving request from HTML5 MP4 player element has sent MP4 byte pockets. In any way, it is possible write stream sink, but is not easy - there is not easy code solution. By the way, the program is called WPFScreenStreamer 之间流式传输视频 - 它通过 HTML5 支持通过 TCP 将 Windows 桌面屏幕的视频和扬声器中的音频流式传输到浏览器。