I am using Azure Media Services and uploading, encoding and streaming videos. Question is, is there a way to attach video titles, descriptions and tags somewhere in Azure Media Services API?
Additional details:
When I process an asset, a new container in Azure Blob Storage is created, and when I click on the blob itself, it has "User Defined Fields" - aka metadata, I could use those, but I am not sure if they are exposed to Azure Media API at all and how to access them.
I searched all over MS documentation and found nothing :/
Currently Azure Media Services API exposing limiting set of metadata about encoded media asset. You can look in https://github.com/Azure/azure-sdk-for-media-services-extensions example of fetching metadata and how it is implemented:
// The asset encoded with the Windows Media Services Encoder. Get a reference to it from the context.
IAsset asset = null;
// Get an enumerator with the metadata for all the asset files.
IEnumerable<AssetFileMetadata> manifestAssetFile = asset.GetMetadata();
If you have requirements to have custom metadata associated with media assets and be able to search, you have to store it in external service like Azure Document DB or Azure Search. Azure Media Services exposes property IAsset.AlternateId where you can store id/key of metadata from external storage for linking purpose.
Thank you for your answer #George, I have spent a week trying and searching and tried what you suggested, but in the end, I came to a conclusion that Azure Media API is not a storage, indexer or anything bud a media processing service, and should be used as such. [Duh...]
So what I deed is introduce SQL database to my abstraction layer that kept all my data for my assets, indexing, etc. That has also helped me to speed up my system, because I no longer make calls to AMS to list my assets - I keep track of them in my database with titles, descriptions, tags, child-parent hierarchy, etc.
For what it's worth, I ended up re-attaching to the Storage Blob that Azure Media Services stores to, and for each specific .mp4 asset (I only had 1 progressive streaming URI) I ended up saving my metadata to the Storage Blob, which worked well for my application.
So I had to use not only the Azure Media Service API for uploading/encoding, but also the Storage API for file based metadata manipulation.
Related
I am currently on a student plan for azure (gotta stay finessing as a college student lol) and am looking for the best way to upload videos to azure blob storage. Currently, I am using an azure function api to upload the video, but I am encountering a "Javascript heap out of memory" error when I try and multiparts parse big video files.
Ideally, I'd be able to quickly upload 3.5 minute music videos from mobile and desktop to azure blob storage with this method.
Either a better way of uploading videos to blob storage from my front-end or a solution for the javascript heap out of memory error would be amazing help.
Here's the link to that other post, if you are curious: How to fix JavaScript heap out of memory on multipart.Parse() for azure function api
Approaches:
After a workaround based on your issue, I would suggest that you use Azure Media Services.
Media Services can be integrated with Azure CDN. Refer to check Media Services-Managing streaming endpoints.
All supported formats use HTTP to transport data and benefit from HTTP caching. In live streaming, actual video/audio data is separated into fragments, which are cached in CDNs.
To start, I recommend that you use the Azure Storage SDK with Node.JS. The SDK will handle everything for you. Attaching few uploaders below to check accordingly.
Upload a video to Azure Blob examples
Refer MSDoc & SO thread by #Gopi for uploading a video with the .mp4 extension to Azure blob storage using C#.
You can upload a video using Azure functions directly. But to use Azure Functions, you must create a back-end component written in.NET, Java, JavaScript, or Python.
You can use the "Azure Storage Rest API" to upload files/video files using a storage account, like you mentioned. You will be able to get the desired result by using this Azure Storage Rest -API-MSDoc.
I wanted to know if it is possible to restore an asset in the Azure Media Services if it is deleted ? I haven't been able to find any officially supported solution for this.
Azure storage supports making backups and then copying back restores the blob. But is it possible to do the same thing in Azure Media Services and get the same assetID and locatorID as the original ones ?
As far as I know, azure media service does not provide back up and restore the assets in your account. Please refer to this article.
We currently don't provide an automated solution to backup the data in your media services account. You can query your media services account for the data you wish to back up and then write it in some sort of storage.
This is the feedback, you could post your idea to help to improve Azure Media Service.
Correct, we don't provide a backup or restore feature for Azure Media Services at this time. The storage account that is connected to AMS can be backed up - and you can configure geo-redundant storage as well.
We have some customers that configure multiple AMS accounts in two regions and upload content to both for High Availability if needed. You can easily create Assets and Streaming locators with the same IDs in two regions as well.
I have a web app that is hosted in Azure; one of it's functionalities is to be able to make a few cuts from the video(generate 2 or 3 small videos of 5-10 seconds from a larger video).
The videos are persisted in Azure Blob Storage.
How do you suggest to accomplish this in the Azure environment?
The actual cutting of the videos will be initiated by a web job. I'm also concerned about the pricing(within the Azure environment), I'm taking into account the possibility of high traffic.
Any feedback is appreciated.
Thank you.
Assuming you have video-cutting code that operates on files through normal I/O: You'd need to download the video file from blob, process it via code (or whatever library you've employed), and then store the result back in blob storage. You cannot reference a blob directly with normal standard IO libraries.
If, however, videos are stored in Azure File storage (which is an SMB layer on top of blob storage, then you will be able to directly manipulate your video files.
Web Jobs run within an App Service (just like Web Apps), so you have access to a certain amount of local disk space (depending on App Service tier) for use. You should have no problem temporarily storing a video file within your web app's disk space, for editing operations.
You asked about cost: Again, assuming you're talking about running code within a Web Job (app service), you're just paying for whatever App Service tier you've chosen.
How you actually do those edit operations is entirely up to you (language, library, etc).
Azure Blob Storage is simply an object store which stores the data. It does not have the capability you're looking for.
Azure Media Service however is the service you should look into. The media served by this service makes use of Azure Blob Storage.
For editing video, may I suggest you take a look at Video Editor Plugin for Azure Media Player. You can read more about this plugin here: https://azure.microsoft.com/en-in/blog/video-editor-plugin/. You can also try it out here: http://ampdemo.azureedge.net/amp_editor.html.
Is it possible to stream on-premises media files through Azure Media Services without storing them in the cloud?
This is not possible. AMS uses blob storage as the source for assets that are being encoded and streamed. From a performance perspective this approach makes sense as well.
Note that the uploaded content is protected using storage protection and access policies.
My goal is to allow a user to upload a video that isn't stored locally on disk. All of the examples I've seen for uploading a video to Azure media services show only files from the local disk being uploaded.
So i decided to try a method mentioned on Stackoverflow before, which is uploading a video firstly to Azure BLOB storage and then from here uploading the video to Azure media services.
So far I've successfully uploaded a video to Azure BLOB storage but I'm not sure on how to get this video to Azure media services.
Is there anyway of just passing the stored videos URI to Azure media services?
I've seen an example of copying an entire storage container to Azure Media services but I'd like to do it on a video by video basis.
Does anyine know of any decent tutorials that explain the steps?
The Asset entity contains digital files (including video, audio, images, thumbnail collections, text tracks and closed caption files) and the metadata about these files. After the digital files are uploaded into an asset, they could be used in the Media Services encoding and streaming workflows.
If I understand correctly, your question relates to how you would address an entity within Azure Media Services without the examples most tutorials use by reading a file from disk. As far as I understand the following line of C# would return an IAsset object that references a blob that is uploaded to Blob Storage.
IAsset inputAsset = UploadFile(#"C:\VideoFiles\BigBuckBunny.mp4", AssetCreationOptions.None);`
The result of this operation could also come from a users upload, you could implement this within your own Web Application. To access this video later on, you should store this AssetId. In your case you want to use the stored Asset ID in a way similar to this:
CloudMediaContext context = new CloudMediaContext("%accountName%","%accountKey%");
string sourceAssetId = "%sourceAssetId%";
IAsset sourceAsset = context.Assets.Where(a => a.Id == sourceAssetId).First();
Now, you have retrieved an Asset by it's AssetId from Azure Media Services. You can run encoding on it, or retrieve Publishing URL's for it.
Sources:
https://github.com/Azure/azure-sdk-for-media-services-extensions
https://azure.microsoft.com/en-us/documentation/articles/media-services-dotnet-get-started/#encode-the-source-file-into-a-set-of-adaptive-bitrate-mp4-files
What you are looking to do is create a new instance of an Azure Media Streamer, and when you do, simply have it point to your current Blob Storage account, and not have it create a new one.
By default, AMS will create a new blob storage account when you first upload a video to it.
I have a tutorial series on Azure Media Services.
I upload videos the same way that you do -- to my Blob storage account first, so that I can place them in a named container. Otherwise, when you just use AMS, it will create a container for you with random characters.
Let me know if you need any further detail.
Is there anyway of just passing the stored videos URI to Azure media services?
Yes. You have two choices here.
You can either:
Pass it as a file stream instead of a path string (there is an overload for that) OR
Create a blobtrigger
function/webjob which which creates an asset and encodes directly
from the blob when it is uploaded. https://learn.microsoft.com/en-us/azure/media-services/media-services-dotnet-how-to-use-azure-functions
I've seen an example of copying an entire storage container to Azure Media services but I'd like to do it on a video by video basis.
Yes, you can specify the blob within the container. See the "Create an Asset from a blob" section here https://github.com/Azure/azure-sdk-for-media-services-extensions