我想从托管在 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 storage 下载 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 文件为空。