验证已上传到天蓝色blob的视频的持续时间 [英] Verify duration of video which has been uploaded into azure blob

查看:77
本文介绍了验证已上传到天蓝色blob的视频的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个应用程序,用户可以在其中上传关于自己的简短肖像视频,以在社区中推广.关键字很短.我想阻止用户上传1小时的史诗.

I'm building an application where users can upload a short portrait video about themselves for promotion within the community. The keyword being short. I would like to prevent users from being able to upload 1 hour epics.

我尝试了一种在客户端进行验证的方法,但是在解决所有可用视频格式的情况下,我决定在服务器端进行验证. 这是我碰壁的地方.

I have tried figuring out a way to verify this on the client side yet with all the available video formats out there I resolved to doing it server side. This is where I hit the next wall.

我通过参考将用户视频按块(由于预期是大文件)上传到我的Blob存储中.此后,文件将被复制到与azure媒体服务帐户关联的另一个存储中.

I upload the users videos in chunks (due to be expected large files) via a reference directly into my blob storage. Thereafter the files will be copied into another storage linked with an azure media services account.

我要验证持续时间,在上传和复制到第二个存储之间.在我尝试过的库( Accord NReco MediaToolkit )中,所有尝试都以一种或另一种方式失败(不支持在Azure网站上运行,无法读取斑点或类似问题.

In-between the upload and the copying to the second storage is where I want to verify the duration. From the libs I have tried (Accord, NReco, MediaToolkit) all have failed in one way or other (Not supporting running in azure websites, not reading from blobs or similar issue).

所以我现在有点卡住了.没有人有任何想法,而不必先通过天蓝色媒体服务进行编码吗?

So I'm kind of stuck at the moment. Does anyone have any ideas how this could be done without having to go through the encoding via azure media services first?

推荐答案

我只需上传到%TEMP%(扩展为d:\local\temp).那是App Service中的本地存储.然后,所有这些库都应针对本地文件系统运行,包括我个人喜欢的 MediaInfo .

I would simply upload to %TEMP% (which expands to d:\local\temp). That's local storage in App Service. All those libs should then work against the local filesystem, including MediaInfo, my personal favorite.

对于Standard Tier,似乎还有足够的空间,这是 Kudu 报告:

For Standard Tier there seems to be plenty of room, here's what Kudu reports:

d:\local usage: 230,397 MB total; 188,630 MB free

所以

upload file
    |
    |                         too long?
check length with video lib ------------- notify user, cleanup local storage
    |
    | all good?
    | 
async upload to blob storage (Media Services)
    |
async cleanup local storage

每晚使用WebJob清理%TEMP%,以解决陈旧/不完整的上传(即,删除6小时以上的文件),以防万一由于意外原因对文件系统的删除调用有时会失败.

Cleanup your %TEMP% with a nightly WebJob to account for stale/incomplete uploads (i.e. remove files older than 6 hours), just in case your delete calls to the filesystem fail from time to time due to unforeseen reasons.

这篇关于验证已上传到天蓝色blob的视频的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆