I'm developing a site whereby I'm using the Azure Blob storage for the media files and that is working fine and is uploading files to Azure and displaying them on the front end without issue.
I have a section for videos that requires me to manipulate the physical file to extract a thumbnail and convert the .MP4 file into an HLS stream (.m3u8 and associated .tls files) and save them in the same directory as the initial file upload .
This worked fine before I installed the UmbracoFileSystemProviders.Azure.Media package as obviously I could use HttpContext.Current.Server.MapPath(filename) to access the file on the hard drive and then open it and extract a .jpg or do the conversion. I am using a 3rd party ffmpeg convertor from NReco to do these conversions which although primarily a desktop DLL works fine for web usage.
I'm using the IMediaFileSystem interface to retrieve the full path to the file, but obviously it is returning this as 'https://accountname.blob.core.windows.net/' etc and I therefore can't physically manipulate the file.
Is there are a way of physically opening/mapping the file from the Azure storage bucket or do I need to retain a copy of the source file on the server hard drive to do these operations?
Some of the files are >2Gb in size and I'd rather not maintain a copy on the local harddrive as that defeats the purpose of using Azure as my storage system.
I am aware that Azure does do a streaming conversion service, but I'm working to a very tight budget (aka none) so I'd rather not incur any additional costs over and above the storage costs if I can help it.
You can inject the MediaFileSystemProvider and then from that you can "open" a stream to the file on blob storage. This will be an IStream, if I recall correctly. So you should be able to use that as you need.
Azure FileSystemProvider File Path
I'm developing a site whereby I'm using the Azure Blob storage for the media files and that is working fine and is uploading files to Azure and displaying them on the front end without issue.
I have a section for videos that requires me to manipulate the physical file to extract a thumbnail and convert the .MP4 file into an HLS stream (.m3u8 and associated .tls files) and save them in the same directory as the initial file upload .
This worked fine before I installed the UmbracoFileSystemProviders.Azure.Media package as obviously I could use HttpContext.Current.Server.MapPath(filename) to access the file on the hard drive and then open it and extract a .jpg or do the conversion. I am using a 3rd party ffmpeg convertor from NReco to do these conversions which although primarily a desktop DLL works fine for web usage.
I'm using the IMediaFileSystem interface to retrieve the full path to the file, but obviously it is returning this as 'https://accountname.blob.core.windows.net/' etc and I therefore can't physically manipulate the file.
Is there are a way of physically opening/mapping the file from the Azure storage bucket or do I need to retain a copy of the source file on the server hard drive to do these operations?
Some of the files are >2Gb in size and I'd rather not maintain a copy on the local harddrive as that defeats the purpose of using Azure as my storage system.
I am aware that Azure does do a streaming conversion service, but I'm working to a very tight budget (aka none) so I'd rather not incur any additional costs over and above the storage costs if I can help it.
Iain Martin
Hi Iain,
You can inject the MediaFileSystemProvider and then from that you can "open" a stream to the file on blob storage. This will be an IStream, if I recall correctly. So you should be able to use that as you need.
Thanks
Nik
Cheers Nick, I'll give that a try.
is working on a reply...