Upload .VTT captions with Azure Media Service video streams - azure

I am trying to achieve uploading an MP4 video to Azure Media services; making it available for streaming via a streaming URL, as well as more importantly and specifically to this question: upload .VTT captions to be shown within the video.
I have worked on integrating the code within this tutorial, more specifically the EncodeAndStreamFiles sample app (described in the document) as a DotNetCore API.
I have managed to retrieve a list of streaming URLs for the Video, and the stream works well (the video is playable).
The next step is uploading a .VTT caption (or subtitle). Unfortunately, I have not found any official documentation from Microsoft regarding this subject. This Stack Overflow question is the only useful information I found. Based on the answers to the question; I am uploading the caption within the same blob container as the video's output asset and referring to it by editing the video's streaming URL (replacing the last part).
So if the video's streaming URL is this:
https://azuremediaservicename-euwe.streaming.media.azure.net/2e262dca-23d9-453d-be00-6a7e60167ab7/HR%20documents.ism/manifest(format=m3u8-aapl)
Then the caption's streaming URL would be:
https://azuremediaservicename-euwe.streaming.media.azure.net/2e262dca-23d9-453d-be00-6a7e60167ab7/HR%20documents.vtt
I am trying to display the video and the caption using the advanced options within this tool. The caption appears within the options, but the actual words don't appear on screen.
I have 2 questions -
Is the uploading of the Caption as part of the blob container, the correct way to upload captions? Or is there a better way (perhaps via the SDK) that I haven't run into yet?
If the answer to 1. is Yes, how should the streaming URL for the caption be generated? Is the example shown above correct?

If you want to store the VTT file in the same storage container than the asset, and make it available as download, then you need to change the predefined policy to
StreamingPolicyName = PredefinedStreamingPolicy.DownloadAndClearStreaming
in line https://github.com/Azure-Samples/media-services-v3-dotnet-tutorials/blob/master/AMSV3Tutorials/UploadEncodeAndStreamFiles/Program.cs#L403
This approach works for clear content but not for protected (DRM) content. For protected content, you should use a separate container (or asset) for the subtitles files.

Related

Is image or file being always downloaded from Google Cloud Storage on click?

Please help me to understand the following, I have a node.js app which I want to run on Google Cloud App Engine, this app will contain some images which are planned to be stored on Google Cloud Storage. On my sample app once I upload an image and get a url (mediaLink or selfLink) image is being downloaded.
Why is that? Each download each click costs money I understand google, but is there any way to make url just show images NOT to be downloaded?
Saving a file from Google Cloud Storage is the same as displaying it. Both action require transferring the content of the image to the device for display or saving.
The action of displaying an image or popping up a save as dialog is controlled by HTTP headers. For example if you have the HTTP header content-type set incorrectly (not as an image) then some browsers will save the file. If you want your image files to be displayed as images set the headers correctly for the type of picture. For PNG files set the header contenty-type: image/png.
You can also force a download with the content-disposition: attachment header.
In summary, it does not matter if you are displaying an image or saving it to local storage, it will cost you money. Both actions requiring downloading (transferring) the contents of the file across the Internet.

Can I record and upload video on Youtube API?

Can I use the YoutubeAPI on a web-app to record and save/upload a video with out it being broadcast live?
Use the method Videos: insert to upload video using YouTube api. About saving/downloading, I think, it's against their Terms of Service.
You shall not download any Content unless you see a “download” or
similar link displayed by YouTube on the Service for that Content.
You can see this SO post for further reference on downloading content in YouTube.
Youtube does not support recording straight to their platform anymore.
https://support.google.com/youtube/answer/57409?hl=en

How do I stream an uploaded video on Azure Media Services

I uploaded a video to Azure Media Services, and clicked the "publish" button. That gave me a publish URL.
I then used the Azure Media Player (http://amp.azure.net/libs/amp/latest/docs/samples.html) to embed my video content on a page.
The problem I'm having is that the video is choppy to start. Perhaps it's the encoding of the video, but I want to make sure, if I want to stream a video, using the media player or anything else, do I just use the "Publish URL"? OR is there a different way of requesting video content to "smooth stream"?
Yes. You use the publish URL for VOD and you have a few url parameters to change the type of streaming if needed. Default is smooth streaming.
Smooth Streaming
{streaming endpoint name-media services account name}.streaming.mediaservices.windows.net/{locator ID}/{filename}.ism/Manifest
HLS Streaming
{streaming endpoint name-media services account name}.streaming.mediaservices.windows.net/{locator ID}/{filename}.ism/Manifest(format=m3u8-aapl)
MPEG Dash Streaming
{streaming endpoint name-media services account name}.streaming.mediaservices.windows.net/{locator ID}/{filename}.ism/Manifest(format=mpd-time-csf)
See what works best for you
You can also test on this page and try the advanced settings
http://amsplayer.azurewebsites.net/azuremediaplayer.html
The Azure Media Services test page has changed since the last post. The new URL is:
https://ampdemo.azureedge.net/azuremediaplayer.html

Azure media services on demand streaming from streaming origin without encoding

I want to encode my videos using ffmpeg and I create a 10MB MP4 file. Then I want to upload it on Azure media service as an asset. Then I want to stream it via Streaming Origin and apply CDN on that origin. I do not want to use ENCODING job from media services. So the problem is that after uploading an asset I see a URL which contains BLOB direct URL where I can stream. But I want to apply STREAMING Origin on this url without encoding job. Which I don't think is possible. What is the solution to that.
Here is the example
CASE 1 - Just uploaded and published
Let's say that I uploaded an mp4 file song on azure portal and i see the url like this
https://fiautomationblobstore.blob.core.windows.net/asset-ea4748ff-0300-80c3-1fe8-f1e525056262/_enr.mp4?sv=2012-02-12&sr=c&si=6c0d7963-8eb9-4568-af27-454e1d09220e&sig=xP0xuk6BTh%2Bbrzgtur%2BJZypr%2FLE505%2Bp%2FQ3xB%2B%2Blj0E%3D&st=2015-07-08T00%3A12%3A06Z&se=2115-06-14T00%3A12%3A06Z
If I publish this it works but of course this is coming directly from the blob storage URL "fiautomationblobstore.blob.core.windows.net"
CASE 2 - uploaded and encoded and published
Where if I encoded another video then published the url was like this
http://tmediasvc.streaming.mediaservices.windows.net/bcdcb0c3-c02a-4148-8e71-4d59caa5b205/enr.ism/Manifest
notice the "tmediasvc.streaming.mediaservices.windows.net" part its streaming origin.
How I can make first file coming from my streaming service "tmediasvc.streaming.mediaservices.windows.net" without applying ENCODING. I want to do this for 2 reasons.
1. I have applied encoding by ffmpeg before uploading
2. The size in second case grows from 16 MB to 100MB strangely. And this is because of very few options on media encoding in azure and i am not sure why there is no option for 360p/480p or less. its all above 720p which is weird. So encoding a file from 16BM to 100MB is Extremely wierd.
Thanks for the help in advance.
Have you tried just uploading it to blob storage, then returning that URL? This way it will not apply any sort of formatting to the original file.
Or am I misunderstanding the question?

How to get a published video URL

I'm trying to build my app based on Windows Media Services REST API (i'm not using any SDK, just plain rest api requests).
My steps are more or less like:
Create Asset
Assign write Access Policy
Assign upload locator
Upload a file to URL specified by upload locator path
Assign download Access Policy
Assign download locator
All those steps seems to work great but - how can i actually get the video streaming URL? I can't see anything, which looks like such url (as far as i know, it should look similar to upload URL from upload locator). Should i "fold" it by myself using some segments from various parts of api ?
Based on this article, i should append the path parameter with name parameter and /manifest (so it should looke like that: <path_param>/<name_param>.ism/manifest) but it gives me ResourceNotFound error. Anyway, i've seen that other people (like SHIBSANKAR) have found some way to obtain all asset urls so i think there is some way to do it but they have not descrbed how they've done it.
After reading all the docs and talking with microsoft support, i have figured it out. All the URL parts are returned by download locator and the formula looks like that:
#{BaseUri}/video.mp4#{ContentAccessComponent}
I hope someone will find that usefull someday.

Resources