问题
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.
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.
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?
回答1:
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.
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
So,
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
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.
来源:https://stackoverflow.com/questions/43681552/verify-duration-of-video-which-has-been-uploaded-into-azure-blob