Detecting Available Qualities of YouTube Videos - youtube

I'm writing a Boxee app that makes use of YouTube videos and I want to be able to display the highest quality version available. I was looking through the YouTube API, but I can't seem to find a way to detect if 720p and/or 1080p versions of the video are available.
Does anyone know how to do this? I'm already using their Data API to collection information about the video, but there doesn't seem to be anything in the payload about different qualities consumable on the web: http://gdata.youtube.com/feeds/api/videos/NWHfY_lvKIQ
I could just hard code fmt=22 and let it default to a lesser quality version, but then I miss out on 1080p (fmt=387).

The information isn't available through the API, but can be queried and changed via JavaScript after the page has loaded (if you embed a video for example).
http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/da4344cc66959ecc

Related

How are videos on Youtube and such sites loaded and how is progress saved?

I hope you are doing well!
I am working on an eLearning website and came across the topic of the video loading. Since videos are of various sizes, it would be impossible to make the user wait for the entire download of the video for them to start watching, so it must be taken as a stream where the video keeps loading content as the user watches (similar to YouTube I guess). However, I am failing to find how this works? I've been recommended the use of SCORM and xAPI to help with this but I am only finding help on how to upload SCORM files or how to write xAPI code and not how to set them up in our website.
How can we make our videos download as the User watches? Are SCORM and xAPI actually what we should be looking for?
For context, we will be using React JS for our Frontend and will be saving the videos on a server.
I would greatly appreciate any advice you have and thank you for your time!
We tried using xAPI and SCORM however we aren't understanding how they might help
SCORM and xAPI by themselves are not going to assist you with this in general. To stream video via an eLearning course you will need to use a video player (such as the HTML5 video player or video.js) that understands streaming video protocols and to encode the video files in a format supported by that player. I would suggest reading about HLS for instance, though I didn't read the entire page, this is a good place to start: https://www.dacast.com/blog/hls-streaming-protocol/
A traditional eLearning course, such as you would have with SCORM, is going to provide a reasonable way to wrap the playing of video such that it can be launched for a learner via an LMS and may capture data such as completion. xAPI is probably suggested because it provides a more robust way of enabling the capture of interaction data such as when the learner plays, pauses, or seeks in a video. My preferred approach for doing this is to leverage cmi5, and there is an example of xAPI video profile usage within a cmi5 course in the Project CATAPULT sample content, see https://github.com/adlnet/CATAPULT/tree/main/course_examples. It could be adapted to leverage something like HLS and get streaming capability. Confirm with your LMS of choice ahead of time whether it supports cmi5 as adoption is still lower than for SCORM.
SCORM Cloud (a bit of a misnomer, https://cloud.scorm.com/) provides builtin video handling via the cmi5 mechanism and will soon support video streaming beyond just from YouTube without the need to author a course separately.

Youtube get camera type

Consider these videos:
http://www.youtube.com/watch?v=U_kZ5Lj-59E
http://www.youtube.com/watch?v=f0pdwd0miqs
The first is probably filmed with a mobile phone's camera, the second with a professional one. I would like to determine this difference.
Q: Is anybody aware of a way of retrieving information about the camera type that was used for a video on Youtube?
Q: Or, is there a more generic way for videos to determine video recording quality?
There is no way to get the camera metadata from a video on YouTube at this point. Theoretically YouTube could capture this information for some videos (and make it available in the future), but not every video file has camera metadata on it. In fact, a lot of videos use more than one camera.
Technically there are other methods of determining "recording quality", but they won't be perfect. For example, you could use the assumption that if a video is available in 1080p it might be better quality than one only available in 480p. However, there can still be a big difference in two videos both available in 1080p.
You can't rely on bitrate either, because YouTube could change the bitrate on you depending on your internet speed.
You can determine a video is available in HD, for example if you execute this query (API V3): https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?id=L8oEtD_CEs0&part=contentDetails&_h=1&, you'll notice I've recorded it in HD ("definition": "hd"), though I did use my shaky hand and phone camera :)
For API V2 we have element described here: http://apiblog.youtube.com/2011/10/more-ways-to-find-what-youre-looking.html.

YouTube API: Get the quality of a video via the API?

Is there any way to tell when a video has been fully encoded at its highest definition via the API?
As far as I can tell, the YouTube API provides the 'state' of a video (processing, restricted, deleted, rejected and failed). However, I can't tell if the API also provides the encoding qualities of the video (240p, 360p, 720i, etc...).
Does anyone know how to get this information?
Taken directly from the docs:
player.getPlaybackQuality():String
This function retrieves the actual video quality of the current video. It returns undefined if there is no current video. Possible return values are highres, hd1080, hd720, large, medium and small.

How (if) is it possible to retrieve via YouTube API Video of a specific size(big one)?

Is it possible to retrieve and specify size of YouTube video?
Normally API gives me videos in small resolution 360p.
But I need way bigger 1080p would be my weapon of choice.
Do you know if it's possible to get this size?
Thanks for help in advance!
There are multiple APIs, so it depends on which you are using. But the embed API has a javascript method to set the quality:
setPlaybackQuality(hd1080);
Read more about the embed-API here: http://code.google.com/apis/youtube/youtube_player_demo.html

File formats for streaming videos in HTML 5 in regular and mobile devices?

I'm putting together a site that will include some instructional videos that will be 1 to 3 minutes long. The users will be accessing these through standard and mobile browsers. I'm particularly concerned with users of i-devices, such as iPhone/iPod Touch/iPad.
To deliver the videos, I'm will probably use videojs.com player - it seems like a pretty robust choice. Unfortunately, I don't know first thing about what file formats and standards to use for encoding files. H.264 Baseline profile seems to be a good choice, but I really need some direction on where to read up on what might be the best choice.
Please help :)
The best resource I've found for this information is Dive Into HTML 5. They have a very concise breakdown of which formats will work with each of the browsers.
The long and short of it, however, is that h264 baseline is the way to go, especially if your HTML5 video player has Flash failover.
While HTML5 video is currently the standard in the mobile space, a back of the envelope calculation reveals that only about 40% of desktop browsers users can view it as compared to Flash's 99%+ market penetration. Moreover, you'd have to encode and store your videos twice (h264 and Theora) in order to reach all HTML5 video capable browsers.
However, by using h264 video and a Flash failover, you can cover all iDevices plus all browser that either don't support HTML5 video, or support HTML5 video for a format other than h264.
One word of warning: iDevices only support the h264 baseline up to level 3.0, so make sure to stay within these specs.
Hopefully that helps.

Resources