Video topic extraction and transcription Posted 1 year ago
This is a quick tutorial on how to transcribe and extract topics from videos using the Yactraq Speech2Topic, API in Mashape.
(Note: Yactraq is giving away $500 to the winner Yactraq category for this coming Mashape April Hackathon Apr 6th, 2013. We require a number of teams to submit to this category to unlock the prize :))
This is particularly useful if you’re trying to get context in the video, which can be used to query ad services to pull relevant content.
The process is very simple, we send a link (YouTube) of a video to be processed to the Yactraq API, and we get back a result with information on topics and transcribed words. This result metadata will indicate when in the video these topics and words occur.
Here’s a sample of the response from a processed video:
And here’s what an app that consumes it looks like in action:
Let’s get started!
Step 1: Get a Mashape key. All calls to any Mashape API requires a Mashape key. If you haven’t done so yet, you can sign up for an account at http://www.mashape.com/signup. You can get your Mashape key in your Dashboard.
Step 2: Request for a Yactraq developer account. We need the Yactraq account so we can make a proper request to process our videos. To request for an account, follow the instructions here.
Step 3: Submit a video processing request through the Yactraq Speech2Topics API. To do this, you would need the YouTube url of the video you want to extract topics from. Make a note of the video id of it as well (e.g. http://www.youtube.com/watch?v=zFOnOLXrMBQ, the video id is “zFOnOLXrMBQ”). We also need information from our Yactraq account, particularly “secret” and “adset” which you can get by logging in to http://api.yactraq.com/ . Also set “start” and “tx” to 1.
My request looks like below:
Then hit “Test Endpoint”. If your request is successful, you would get a response like below:
Step 4: Get some coffee and wait for your request to be processed (According to Yactraq the waiting time takes about half or a third of your video length).
Then you can try to check the status by calling the same endpoint, only this time set “start” to “0” or leave it blank. This will tell the API to get the results, instead of initiating a new request.
If your request is successful, you should get a lengthy response like the one I showed you at the beginning of this tutorial. What you didn’t see there are the transcription results which look like this:
For both parts of the response, there are “ts” values per topic or word transcribed. You can use this ts (timestamp in seconds) value to see where the words and topics occurred in the video.
I have created a sample app that shows how this can be done here. (the app in the video at the top).
We hope this will get you started in building your own apps that use the Speech2Topic API in Mashape. Let us know if you have suggestions or comments for our next tutorial!