Video Metadata: Exploring advanced use cases and their benefits
Video Metadata: Exploring advanced use cases and their benefits
Learn what is video metadata and how it finds application in various scenarios like e-learning or video sharing.
Zoltán
February 22, 2024
Metadata, within the context of api.video, is like a Swiss Army knife - it gives you a simple set of tools to solve countless complex problems. It can help you integrate video-on-demand (VOD) into your platform or application, all the while supporting and even enhancing the way you build your product.
What is metadata?
Metadata enables you to add an extra layer of data to the videos that you or your users upload. You can define an array of custom key-value pairs and use the values to enhance your application or website. Each video can have multiple key-value pairs in a metadata array, and you can use them to filter for specific content when listing videos, and to integrate video content into your app or website. You can add, edit, or remove metadata from video using both the api.video API and the Dashboard.
Now, let’s dive into some use cases where video metadata can be a game changer!
Video metadata for e-learning use cases
In this use case, we will look at how using metadata can help you solve some common problems that you might encounter when creating an e-learning platform.
Let’s say you want to offer video lessons for your users, and that you want to enable teachers to create courses (a series of lessons) on different topics, and varying levels of difficulty. For the sake of this example, let’s propose these courses:
- Basic Node.js - 5 lessons
- Advanced Node.js - 10 lessons
- Advanced Sushi Making - 8 lessons
These courses already imply a very large amount of background information that you’ll need to handle. Think about questions like:
- How do you know the order of lessons?
- What if you want to show all lessons on a certain difficulty level, regardless of the course?
- What if multiple teachers create lessons in the same course and you want to give them extra payments based on how popular their lessons are?
- What if you want to enable students to rate lessons on a scale of 1 to 10?
- Better yet, what if you want to enable teachers to grade video-based homework for your students using your platform?
All of this fits neatly into metadata. Here’s an example set of key-value pairs that could belong to any lesson’s video:
"metadata": [
{
"key": "type", // This helps you identify the content type. Useful if you want to enable both teachers and students to upload videos.
"value": "lesson"
},
{
"key": "course_id", // This helps you identify the course. Useful if you have multiple courses on the same topic.
"value": "sushi"
},
{
"key": "lesson_number", // This helps you identify the video as the 3rd lesson.
"value": "3"
},
{
"key": "difficulty_level", // This shows the difficulty of this course.
"value": "advanced"
},
{
"key": "teacher", // This can be the name or the ID of a teacher who uploads videos.
"value": "Jiro Ono"
},
{
"key": "rating", // This can be the average score of all ratings on this video. Make sure you track users who already rated a video to avoid multiple votes and false results.
"value": "8"
}
]
Now let’s see how a student’s own video submission can be enhanced with metadata by giving them a few fields that they can fill out:
"metadata": [
{
"key": "uploaded_at", // The full ISO8601 date and timestamp helps students verify that they actually submitted their homework on time.
"value": "2024-04-15T15:50+00Z"
},
{
"key": "type", // This helps you identify the content type as homework.
"value": "homework"
},
{
"key": "uploader_notes", // Enabling uploaders to tie a note to their submission can help your users have a more seamless experience.
"value": "I messed up the rice a bit, it was too sticky!"
},
{
"key": "student", // This can be the name or the ID of a student who uploads videos.
"value": "John Doe"
},
{
"key": "grade", // This can be the grade given by a teacher who reviewed the homework submission. You can even implement a notification system to let teachers know that there is a new homework submission.
"value": "4"
},
{
"key": "reviewer_note", // Let teachers add a note to the grades they give.
"value": "Use less water next time!"
}
]
How to add video metadata to your e-learning solution
Let’s dive into the endpoints can help you solve the above problems.
- First, you create a video object. This is the step where you can define the
metadataattributes for each video object. Then, you upload a video into that video container object. - You can surface some of the relevant fields for your teachers who would upload their videos:
course_id,lesson_number,difficulty_level, and so on. - For students, you can surface the
uploader_notesfield on your platform. - For listing and filtering by
metadataon your frontend, use the list all videos endpoint. You can use themetadatakeys and values in your request as query parameters to filter specific content. For example you can list all homeworks with this simple request query:
{base_URL}/videos?metadata[type]=homework
- For video ratings, use the update a video endpoint. Make sure you track the different users who already rated a specific video based on their user ID and the
videoID. Store their ratings and simply calculate an average rating, then use that result to edit the video metadata in themetadata.valuefield wheremetadata.keyisrating. - For grading homeworks, you can also use the update a video endpoint. Just update the
metadata.valuefield wheremetadata.keyisgrade. You can make excellent use of thevideo.encoding.quality.completedwebhook to create notifications for teachers whenever a video withmetadata.key = typeandmetadata.value = homeworkis uploaded. Learn more about webhooks in the developer documentation!
Remember, you can use any of these key-value pairs to list videos - use them to create a nice filtering & ordering functionality on your platform for a better user experience.
Video metadata for sports-themed video sharing use case
In this use case, we will look at how metadata can help you offer a platform where people can share their adventures through videos. You can also make things a bit more exciting by offering them the functionality to display their videos’ locations on a map.
For the sake of this example, we will enable users to vote with 👍 / 👎 on specific videos, and store the results in metadata for accurate tracking.
In such a case, when users upload a video, you can use the metadata field to define key-value pairs like these:
"metadata": [
{
"key": "geotag_location", // The WGS84 coordinates of where the video file was recorded.
"value": "N 51.744485 E 10.919480"
},
{
"key": "type", // This helps you identify the content type as mountain cycling.
"value": "mountain_cycling"
},
{
"key": "uploader_notes", // Enabling uploaders to tie a note to their submission can help your users have a more seamless experience.
"value": "I got chased by a bear!"
},
{
"key": "score", // This can be the calculated score of all thumbs-ups or thumbs-downs on this video. Make sure you track users who already rated a video to avoid multiple votes and false results.
"value": "8"
}
]
How to add video metadata to your video sharing platform
Now, let's see the endpoints that can help you solve the above problem.
- The first few steps are the same as with the e-learning use case:
- First, you create a video object and define the
metadataattributes. Then, you upload a video into that video container object.
- First, you create a video object and define the
- For listing and filtering by
metadataon your frontend, use the list all videos endpoint. Here’s an example request query that filters the mountain cycling videos:
{base_URL}/videos?metadata[type]=mountain_cycling
- You can use open-source tools to grab the geolocation tags from the uploaded video files. You can then feed these coordinates to any map API, and display them per user. There’s a host of interesting directions that you can take with this! You can even make this a full-fledged feature by accepting trek logs, or GPX files from your users and feeding them to a map API to display routes instead of single points of interest.
- For the 👍 / 👎 feature, you can implement a like & dislike button on your frontend, and store the number of likes and dislikes to calculate an overall score for each video.
- Make sure you track users who push these buttons to avoid duplicate votes!
- Read the value of
scorethrough the Retrieve video object or List all video objects endpoints when you load the videos on your frontend. - When you update a score after a user voted, use the update a video endpoint to update the
metadata.valuefield wheremetadata.keyisscore.
There you go, that's it!
Appreciating the significance of video metadata is important when it comes to online videos. This essential element acts as the foundation for organizing video content, enhancing searchability, and customizing video experiences. Whether you're someone building an app or a content creator or a viewer, the use of metadata is sure to unlock fresh routes for engagement and discovery.
Dive into the developer documentation to understand more.
To start using api.video and see how all this works, sign up for a free sandbox account now!