download-equirectangular-youtube-video

Download equirectuangular 360-degree videos from Youtube in highest quality

Recently, Youtube has developed their own propriety encoding scheme for 360-degree videos. Most videos from Youtube which have 2K and 4K resolution have already been converted into this format.

As a result, if you download these videos, you will see the frame is cut and arranged into two rows Youtube propriety format

The equirectangular is still useful in some niche cases e.g. showing snapshot to represent the video content. In oder to download the equirectangular format, youtube-dl is the best solution:

Install youtube-dl with Python:

Updated (May-10-2023), youtube-dl is obsoleted, now switch to yt-dlp, which has similar syntax

pip install --upgrade yt-dlp

Update youtube-dl to the newest version: yt-dlp --update

Execute this command to download highest resolution in equirectangular:

yt-dlp -f bestvideo[ext=mp4] --no-check-certificate --user-agent '' URL

The downloaded videos should be in equirectangular format now: Equirectangular

Convert stereoscopic 360-degree video to monoscopic

Sometime, a video is in stereoscopic format. The equirectangular frames show two similar parts on top of each other like this: Stereoscopic

In order to get the equirectangular, simply discard one part of the frame with ffmpeg:

ffmpeg -i [InputVideo] -vf crop=h=in_h/2:y=0 -c:a copy [OutputVideo].

The result is an equirectangular frame. Monoscopic