gpt4 book ai didi

asp.net - Azure Web 应用程序中的 Microsoft 媒体基础

转载 作者:行者123 更新时间:2023-12-03 01:07:38 26 4
gpt4 key购买 nike

您好,因为我正在使用 NAudio 工具将 mp3 文件转换为 wav,我需要在目标主机上安装 Microsoft Media Foundation。但是,Azure Web App 后端的服务器没有安装 Media Foundation。请问有什么办法可以启用吗?我不想最终使用虚拟机...

谢谢。

最佳答案

Please is there any way how to enable it? I do not want to end up with virtual machines

我还没有找到任何方法来做到这一点。我建议您尝试任何其他方法将 mp3 转换为 wav,而不依赖于 Microsoft Media Foundation。

FFmpeg 是适合您的解决方法。以下步骤供您引用。

  1. 从以下站点下载它的 Windows 版本。

Download FFmpeg for Windows

  • 解压软件包并将“ffmpeg.exe”文件复制到您的项目中。例如,将此文件复制到 Web 应用程序的 bin 文件夹中。

  • 安装 ffmpeg .NET 包装器包。 Web 上有许多 ffmpeg 的 .NET 包装器。在我这边,我使用 MediaToolkit 。您可以通过搜索“MediaToolkit”从 NuGet 安装它。

  • 使用以下代码将 mp3 转换为 wav。

  • var inputFile = new MediaFile { Filename = Server.MapPath(@"/Content/testmp3.mp3") };
    var outputFile = new MediaFile { Filename = Server.MapPath(@"/Content/testwav.wav") };

    using (var engine = new Engine(Server.MapPath(@"/bin/ffmpeg.exe")))
    {
    engine.Convert(inputFile, outputFile);
    }
  • 将 Web 应用程序部署到 Azure Web App 后,您需要手动将“ffmpeg.exe”文件复制到 Azure Web App 的 bin 文件夹中。
  • 关于asp.net - Azure Web 应用程序中的 Microsoft 媒体基础,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43805338/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com