Azure Blob Storage Videos - azure

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?

Related

Best way to upload medium sized videos to azure blob storage?

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.

audio stop playing after few mins hosted on azure file storage

I have few mp3 files stored on azure file storage. when try to play them in chrome browser with html audio tag, I see the audio stop playing after few mins. do I need to migrate them to azure blob storage for better streaming?
Yes, you would get better streaming support if you move your audio files to Azure Blob storage, and store them as blobs. Blob storage is designed for supporting streaming content. Read more about it here. Azure File storage is more for supporting migration scenarios, from on-prem to cloud, and to augment or replace file shares and servers.

Azure media service vs regular file storage for processing videos

What should I use from Azure for an application where I am uploading videos and I want to process videos to obtain information with my own worker roles but I dont want to stream the videos. Should I use Media service or regular blob storage?
#Devsined, per my experience, my suggestion is that uploading & processing videos to & from blob storage is the better choice to obtain information. Even I think, if having Azure App services consideration, you can upload videos into queue storage first, then to store into blob storage, and using webjobs to handle the vedio from queue and record the obtained inforamtion to Azure Database.
Any concern, please feel free to let me know.

upload video from azure blob to azure media services

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

Can I get Azure Blob storage to send me a blob resized?

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.

Resources