我已经实施了一个UWP C#应用程序,通过HTTP将我的网络摄像头直播到使用MPEG-DASH的浏览器。
我已经成功实现了HTTP服务器和HTML5 / Javascript客户端。
对于MPEG-DASH直播流,我使用H.264编码配置文件。作为视频容器,我想使用“MPEG2TS”。但它抛出异常,无法使用它(参见下面的代码示例)。
ContainerEncodingProperties似乎支持“MPEG2TS”视频容器。
Windows 10和UWP Apps似乎支持使用“MPEG2TS”容器的H.264编码。 Supported codecs - UWP
为什么我不能在ContainerEncodingProperties对象中将Subtype属性设置为“MPEG2TS”?
var mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync();
var mediaEncodingProfile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.HD1080p);
var containerEncodingProperties = new ContainerEncodingProperties();
containerEncodingProperties.Subtype = "MPEG2TS";
//Throws System.ArgumentException: 'Value does not fall within the expected range.'
mediaEncodingProfile.Container = containerEncodingProperties;
var stream = new MemoryStream().AsRandomAccessStream();
await mediaCapture.StartRecordToStreamAsync(mediaEncodingProfile, stream);