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
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 am using Azure Media Services and I need to encode an Append Blob using Job, the error I get from the Job is this:
While trying to download the input files, the files were not accessible, please check the availability of the source.
I must mention that the Append Blob is created by uploading a video file in chunks. Also, if I try to encode a Block Blob, it works perfectly.
Is Azure Media Services restricting the Job to only work on Block Blob or is there another problem that makes the job fail?
Welp, I just found that media services assets only accept Block Blobs.
More info here, this is the only article I found that talks about the type of blob stored in an asset...
An Asset is mapped to a blob container in the Azure Storage account and the files in the Asset are stored as block blobs in that container.
I'm creating a xamarin forms app with Azure and I want it to use large images and videos.
I already know how to make it work with images (Blob Storage and Azure functions) but I have no idea with videos.
I mean if an user upload a 4K video into my blob storage, it has to be compressed (probably before being send to the blob storage). I don't know where to start - I've seen Blob storage encoding, Media services and CDN but I don't know if it's the right path. Can someone enlighten me on that matter?
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.
I have an MVC application which allows users to sell items and upload images associated with each item. I am using Azure Blob storage to store the images. Once the image is stored in Azure, the MVC backend might retrieve it and resize it (usually shrink it) before sending it to the client, depending on requirements. Is there anyway I can request a file from Azure and have Azure resize it for me? This would save on the expense of sending a large image file to my MVC controller, which I then resize and stream to the client. Of course, I know I could save multiple copies of each image in Azure, each with the size I might need.
No, Azure Blob storage is not designed process the content of your files in any way.
Simple binary upload and download.