【问题标题】:How to extract Thumbnail of MP4 Video located in azure storage如何提取位于 Azure 存储中的 MP4 视频的缩略图
【发布时间】:2019-07-26 23:15:41
【问题描述】:

我想从托管在 Azure 存储中的 mp4 视频中提取缩略图。我目前在 C# 中的方法使用 NReco NuGet 包:

但这是一个本地文件。如何从 azure 存储文件中提取拇指。

string mp4inputpath = server.mappath("~/testfolder/myvideo.mp4");
string thumbOutputPath = server.mappath("~/testfolder/mythumb.jpg");
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
// Get the thumb at the frame 1 second into the video
ffMpeg.GetVideoThumbnail(mp4inputpath, thumbOutputPath, 1);

这行得通!但我需要为 mp4inputpath 使用 azure 存储文件 url。

我可以从 azure 存储下载 mp4 文件并将其临时保存到我的 azure Web 应用程序中。我可以通过编程方式做到这一点。

然后提取拇指,即 ffMpeg.GetVideoThumbnail(mp4inputpath, thumbOutputPath, 1);

然后删除我应用中的临时 mp4。

这可行,但我不知道将 mp4 文件下载到我的 azure Web 应用程序中是否可取。我不知道它是否会扩展。到目前为止,这是我唯一的解决方案。

string mp4Url = @"https://mysorageaccount.blob.core.windows.net/mp4/vacation/summer/dogbarking.mp4";
string thumbOutputPath = server.mappath("~/testfolder/mythumb.jpg");
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
// Get the thumb at the frame 1 second into the video
ffMpeg.GetVideoThumbnail(mp4Url, thumbOutputPath, 1);

这似乎不起作用。没有错误,但是 thumbOutputPath 文件是空的。

【问题讨论】:

    标签: c# azure azure-storage azure-blob-storage


    【解决方案1】:

    您所做的几乎就是您必须做的,因为您无法像打开本地文件一样在 Azure 存储中打开对象。因此,您需要将文件抓取到本地文件或流中。

    至于扩展:这将取决于您在 Web 应用程序中运行的大小(和实例数量)。请注意,您的存储帐户和 Web 应用应位于同一区域,以减少延迟并避免出口带宽费用。

    【讨论】:

      猜你喜欢
      • 2012-10-30
      • 2020-10-21
      • 1970-01-01
      • 1970-01-01
      • 2020-10-18
      • 2012-04-14
      • 2012-09-30
      • 2010-11-19
      • 2012-03-28
      相关资源
      最近更新 更多