The consumption of video content on the Internet is increasing by leaps and bounds. Earlier video was just a medium for entertainment content. However, nowadays video blogs have emerged and even marketing and promotional messages are delivered via video clips. This has lead to a few challenges in managing and distributing video based content.
Unlike the HTML and text based content exchanged over the World Wide Web, audio and video based media content has more technicalities. Depending upon the speed of Internet connection these factors impact the quality of delivery of this medium. One way to solve this problem is to make different copies of the video at different resolutions and FPS (Frames Per Second) and distribute them in an intelligent way, based on the device capabilities and internet speed. The Get Video and Audio URL API does exactly that. In this API tutorial, we will explore how this Get Video and Audio URL API works and we will also take a look at a few use cases where this API can be useful.
The Get Video and Audio URL API is integrated in Rakuten RapidAPI so you can log into your account and access the API console directly.
In case you don’t have an account on Rakuten Rapid API, sign up now and get your universal API key to access the Get Video and Audio URL API and thousands of other APIs hosted on Rakuten RapidAPI.
Overview of Get Video and Audio URL API
The Get Video and Audio URL API acts somewhat like a media converter. For a given URL containing a video, it spews out several URLs containing the same video at different bitrates, resolutions and file formats.
Head over to the API console and you can see the API endpoints.
Before proceeding to explore the endpoints, take a look at the pricing tab and subscribe to the BASIC subscription. This plan gives you 500 API calls for free.
The “GET /supported-sites” endpoint lists all the supported web based video hosting services whose URL can be taken in as video input. This endpoint does not accept any parameter.
If you take a look at the API response, you will see a list of the names of the video services on the Internet, starting with YouTube.
Since YouTube is the most popular video service, we will use it to test the API.
Now, take a look at the “GET /” endpoint.
This endpoint accepts only one parameter ‘url’ which is the URL of video hosting service. In case of YouTube you can directly use the URL of the YouTube video link.
Let’s trigger the API with the default Youtube URL.
Here is the main JSON envelope of the API response.
“message”:”Successfully received info.”
“description”:”Music video by Taylor Swift performing Shake It Off. (C) 2014 Big Machine Records, LLC. New single ME! (feat. Brendon Urie of Panic! At The Disco) available now. Download here: https://TaylorSwift.lnk.to/MeYD ►Exclusive Merch: https://store.taylorswift.com ►Follow Taylor Swift Online Instagram: http://www.instagram.com/taylorswift Facebook: http://www.facebook.com/taylorswift Tumblr: http://taylorswift.tumblr.com Twitter: http://www.twitter.com/taylorswift13 Website: http://www.taylorswift.com ►Follow Taylor Nation Online Instagram: http://www.instagram.com/taylornation Tumblr: http://taylornation.tumblr.com Twitter: http://www.twitter.com/taylornation13″
“title”:”Taylor Swift – Shake It Off”
At the top level, you can see a few important keys such as “description”, “title” and “tags” that provide general information about the video. Apart from that, you can also get the stats on likes, dislikes and view counts.
But the most important data resides within the “streams” key. Let’s expand one of the data elements within this key.
Take a closer look and you can find the format, codec, fps and other information about the stream. From that, you can tell that this is a MP4 video with 640×360 resolution.
You can copy and paste the “url” key value on a browser and play the video. However since this video is of 640×360 resolution, it is more suitable for small screen devices.
If you want to larger resolutions with better quality then scroll down and expand the other items within the “streams” key. You should see a listing for 1080p resolution with 24 fps.
This is a full HD video. This is what you would expect to watch on a big screen.
If you explore further you can also find some streams which are “audio only”.
That’s the power of this API. The response contains 22 separate media stream URLs to choose from. This enables you to choose the most suitable stream for the device where you are consuming the media.
Note: This API may not work for some videos uploaded from certain countries. Also, URLs from some sites listed in the ‘GET /supported-sites’ endpoint may not be supported and will return an error in API response.
Three Ways To Leverage Get Video and Audio URL API
Content Delivery Networks offer a smoother experience to web users by replicating and distributing content in local geographical area . ISPs (Internet Service Provider) also maintain a cache of popular content on their repository to save bandwidth and to offer better download speeds to their subscribers. By using an API like Get Video and Audio URL ISPs can cache those popular videos locally and perform intelligent distribution that delivers video content based on the type of device connection speed limits.
With this API, transcription of video to text information becomes easier. SInce you anyways get the audio file of the video, you can use one of our popular speech to text APIs to extract the spoken words on the audio file and convert them into text.
How often have you thought about searching a long video lecture using Google-like text based search? Imagine you have such an app where you key in a search keyword. The application then scans the video and gives you a list of time values on the video track where your search keyword was spoken during the lecture. Again, using a speech to text convertor, you can get the complete text and then add some additional metadata to capture the video track time.
This can become an interesting application given that there are not many services who offer Video based search. Videoken is one such company working on a proprietary technology to deliver a similar experience.
That’s a wrap on this API tutorial covering Get Video and Audio URL API. Next time you want to host your own video content or perform further processing on video clips, you might find this API handy.
If you are on the lookout for more options then check out our Video API Collection. Please leave your comments below if you have more questions. We will be back soon with yet another interesting API tutorial.