Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get YouTube Video dimensions (width/height)

I’m trying to get the size of a YouTube video. I’m using a Gdata API call to retrieve the basic informations (title, URLs, thumbnails and categories) but I can’t find the video dimensions.

I’m embedding some videos on a website using YouTube Data API server-side calls like this: http://gdata.youtube.com/feeds/api/videos/z_AbfPXTKms?0=v&1=2&alt=json. Unfortunately, there is no reliable information on video dimensions (all the preview images are in 4/3 rate even with widescreen videos).

What I am trying to accomplish is to fit the video exactly into the player; the player width is fixed, so I just need the original dimensions or at least the proportion.

Is there any way to retrieve this kind of data with the Youtube API?

(My fallback plan is to set the player size to 4/3 and never watch back, but any help is appreciated!)

like image 788
Minkiele Avatar asked Mar 01 '12 10:03

Minkiele


People also ask

How do you find the width and height of a video?

Right-click the file and click Properties. Click the Details or Summary tab. In the Details under Video, you will see the frame width and frame height, and additional important video information.

What's the width and height of a YouTube video?

Standard YouTube videos: Aspect ratio: 16:9 only; Dimensions supported (in pixels): 426 x 240, 640 x 360, 854 x 480, 1280 x 720, 1920 x 1080, 2560 x 1440, 3840 x 2160; Size limit: 128 GB maximum (or 12 hours irrespective of size);


1 Answers

You can also get it thanks to the oEmbed implementation of YouTube. Example:

https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=hUvbb_eUP84&format=xml

format=json is also accepted.

like image 129
Isra Avatar answered Sep 17 '22 10:09

Isra