【问题标题】:Video decoding in UWPUWP 中的视频解码
【发布时间】:2016-04-28 18:03:20
【问题描述】:

我有可以播放 .m3u8 文件的应用程序。 但是,当视频使用MPEG 1/2 (mpgv) 编码时,它只显示空白屏幕。打开H.264 之类的视频时,一切正常。怎么了?

代码如下:

using Microsoft.Media.AdaptiveStreaming;


//Listing: MainPage.xaml.cs -> class
private MediaExtensionManager extensions;
private PropertySet propertySet;
private IAdaptiveSourceManager adaptiveSourceManager;


//Listing: MainPage.xaml.cs -> class -> constructor
propertySet = new PropertySet();
extensions = new MediaExtensionManager();
adaptiveSourceManager = AdaptiveSourceManager.GetDefault();
propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager;
extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", propertySet);
extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml", propertySet);
extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/x-mpegurl", propertySet);
extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "video/mp2t", propertySet);
extensions.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", propertySet);



//Listing -> MainPage.xaml.cs -> OnNavigatedTo method
//Getting manifest.m3u8
var link = new Uri("path_to_remote_m3u8_file");
Player.Source = link;
Player.Play();


//Listing: MainPage.xaml
<MediaElement x:Name="Player" />

通常,在.m3u8 中,我们有.ts 文件的列表。但是H.264编码的可以播放,MPEG-1MPEG-2编码的不能播放。

我想我需要向extensions 添加更多处理程序,或者我应该向Microsoft Player Framework 添加更多处理程序,但它们没有适用于 Windows 10 的Dash plugin,因此按照this 示例我无法完成结果。或者可能是 FFmpeg?

【问题讨论】:

    标签: c# windows-store-apps win-universal-app m3u8


    【解决方案1】:

    Windows 10 不支持原生 MPEG2 视频编解码器。

    不过,Windows 10 确实原生支持:

    • HLS

    • MPEG DASH(实时配置文件)

    如果您使用适用于 Windows 10 的 Smooth Streaming Client SDK,它也支持 Smooth Streaming。

    您使用了指向我的博客的链接,该链接与 Windows 8.1 而非 Windows 10 相关。您将在我的 github 上找到通用视频播放器的示例,支持 DASH、HLS 和 Smooth Streaming + PlayReady DRM: https://github.com/flecoqui/Windows10/tree/master/Samples/UniversalMediaPlayer

    此示例应用程序与运行 Windows 10 的 PC、平板电脑、手机和 XBOX One 兼容。

    如果您想播放 MPEG2 内容,也许您可​​以使用 VLC。 VLC 确实支持 MPEG2 编解码器。 尝试 VLC 3.0 每晚构建
    http://nightlies.videolan.org/build/win32/
    VLC 3.0 应该很快就会成为 RTM。

    如果我回答了你的问题,请告诉我

    【讨论】:

    • 感谢您的回复。我无法打开我的MPEG-2 文件,所以我将寻找其他解决方案。
    猜你喜欢
    • 1970-01-01
    • 2018-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-16
    • 2021-08-17
    • 2017-11-07
    相关资源
    最近更新 更多