banner 728x90

Detecting video resolution

In Mobile Web Development 41 views
banner 728x90

Video resolution has always been something I was interested in, starting with the purchase of my first HD television. The HD video quality felt life changing, especially when watching the World Cup, for which I had bought that TV. I transferred that enthusiasm to an early adopter of 4K TV, which is absolutely amazing.

Nowadays you can get 4K videos on YouTube, Netflix and other networks, and I see that Samsung and Sony even offer 8K televisions. With that in mind, I wanted to find out how I could detect the video resolution of a downloaded video file. Let's take a look at it!

Standard video resolutions

Following are standard video resolutions that you may recognize:

Standard Resolution Aspect ratio Pixels
DVD 720 × 480 (NTSC) 4: 3 or 16: 9 345600
720 × 576 (PAL) 414720
720p (HDTV) 1280 × 720 16: 9 921,600
1366 × 768 (FWXGA) 1049088
1080i, 1080p (HDTV, Blu-ray) 1920 x 1080 16: 9 2073600
4K (UHDTV) 3840 x 2160 16: 9 8294400
8K (UHDTV) 7680 x 4320 16: 9 33177600

This Wikipedia page offers other popular resolutions that are used on different devices.

Detect video resolution with ffprobe

Installing ffmpeg offers another utility, ffprobe, with which we can get the resolution of a video file, albeit with a cryptic command:

eval $ (ffprobe -v error -of flat = s = _ -select_streams v: 0 -show_entries stream = height, width MyVideo.mkv)
size = $  x $ 
echo $ size // "3840x1606"

We can create a shell alias function to make this type of video resolution query more dynamic:

function getVideoResolution () 

On many media sites you can choose the desired video quality, so it is useful to know that the maximum video quality is available (that of the original source, in theory).

Fetching the resolution of a video is not difficult with ffprobe!


banner 728x90
author
Author: 
    Script & Style Show: Episode 1: Marc Grabanski
    Script & Style Show: Episode 1: Marc Grabanski
    During this second episode of the Script
    AWS AppSync region expansion and new functions for API keys
    AWS AppSync region expansion and new functions for API keys
    AWS AppSync, a managed GraphQL service with
    What is the best time to involve your mobile app users?
    What is the best time to involve your mobile app users?
    When talking to customers about mobile analysis,
    How to make a Twitter bot with Node.js
    How to make a Twitter bot with Node.js
    Twitter bots have been in the news

    Leave a reply "Detecting video resolution"

    Must read×

    Top