Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the maximum length of a youtube video id?

Tags:

youtube

video

I'm developing an application that displays youtube videos. I want to store the video id's in a database, but because there are going to be a lot of videos, I want to minimize the required space, so does anyone know the maximum length of a video id on youtube?

like image 721
bigblind Avatar asked May 30 '11 19:05

bigblind


People also ask

Can YouTube run out of ID?

With so many videos now live on the site, some users may wonder if YouTube will ever run out of the 11-digit video IDs it uses to make each upload unique. As content creator Tom Scott explains, that won't be a problem.

Are YouTube video IDs the same length?

The individual characters come from a set of 64 possibilities (A-Za-z0-9_-). 64^11 is somewhat more than 2^64. (10 characters would not be enough.) So basically each youtube ID is actually a 64bit number.

What is the YouTube video ID?

A YouTube Video ID is a unique ID to identify a video which is uploaded to YouTube. A YouTube video ID is used to create a unique URL to show the video and can be used to embed a YouTube video on any website. It's not possible to change a video ID of a video.

How long is a YouTube URL?

ID-based URL has a random string of 24 characters (numbers and letters) at the end of the URL to give you a unique channel ID.


2 Answers

It's almost certainly going to stay at 11 characters. The individual characters come from a set of 64 possibilities (A-Za-z0-9_-).

64^11 is somewhat more than 2^64. (10 characters would not be enough.) So basically each youtube ID is actually a 64bit number. And I quite doubt they will ever run out of those.

If you want to save space in your database you could theoretically convert the IDs to 64bit numbers then convert them back later. But you would need to know how youtube does the conversion so it's not practical. (Since 64^11 is more than 2^64 you can't store all possibilities, so you need to know which ones are impossible and google doesn't say.)

It takes 66 bits to store all possibilities. So you could actually store a 64bit number plus a 2 bit number and save some space that way. Or more practically store 9 8bit values - you would save only 2 bytes per record though over storing it as text, so it's probably not worth it.

like image 59
Ariel Avatar answered Sep 25 '22 13:09

Ariel


The video ID of a YouTube video is currently 11 characters in length. Here are a few links that I found:

http://drupal.org/node/175482

http://snipplr.com/view/19232/retrieve-youtube-video-id-from-a-yt-url/

However, while this is the current standard, there is no official stance on how long the video ID can be. Here is a posting to that effect from a team member at YouTube:

http://osdir.com/ml/youtube-api-gdata/2009-10/msg00237.html

like image 38
IAmTimCorey Avatar answered Sep 22 '22 13:09

IAmTimCorey