<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.css?cache=2026-11-13T15:19:59+00:00" type="text/css"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<html:meta xmlns:html="http://www.w3.org/1999/xhtml" name="viewport" content="width=device-width" />
<channel>
	<title>vlc &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/vlc/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Sat, 18 Jan 2025 11:12:20 +0000</lastBuildDate>
	<language>en-GB</language>
	<copyright>© Terence Eden. 🄯 CC BY-SA. See https://shkspr.mobi/blog/copyright-and-copyleft/</copyright>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>vlc &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Downloading 360 Videos from YouTube (and playback in Linux)]]></title>
		<link>https://shkspr.mobi/blog/2021/01/downloading-360-videos-from-youtube-and-playback-in-linux/</link>
					<comments>https://shkspr.mobi/blog/2021/01/downloading-360-videos-from-youtube-and-playback-in-linux/#respond</comments>
				<dc:creator><![CDATA[Terence Eden]]></dc:creator>
		<pubDate>Mon, 18 Jan 2021 16:56:11 +0000</pubDate>
		<category><![CDATA[360]]></category><category><![CDATA[linux]]></category><category><![CDATA[video]]></category><category><![CDATA[vlc]]></category><category><![CDATA[YouTube]]></category>		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=37786</guid>

		
		<description>Inspired by this conversation on Mastodon  YouTube hosts 360 videos. Here's one of mine, wandering through the Houses of Parliament. You can drag the video to see all around.    If you let YouTube-DL download the "best" version, you'll end up with a video which looks like this:    Each lens' view has been horizontally stretched, and then stitched into an over/under view. This is in Google's…</description>
			
		<content:encoded>&lt;p&gt;Inspired by &lt;a href="https://retro.social/@ajroach42/105543202951711845"&gt;this conversation on Mastodon&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;YouTube hosts &lt;a href="https://shkspr.mobi/blog/2017/11/review-poweradd-360-camera/"&gt;360 videos&lt;/a&gt;. Here's one of mine, wandering through the Houses of Parliament. You can drag the video to see all around.&lt;/p&gt;

&lt;iframe title="360 Test - Parliament" width="620" height="349" src="https://www.youtube.com/embed/UXNXnEzJD6w?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""&gt;&lt;/iframe&gt;

&lt;p&gt;If you let YouTube-DL download the "best" version, you'll end up with a video which looks like this:&lt;/p&gt;

&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2021/01/Over-Under.jpg" alt="An over-under video." width="1024" height="512" class="aligncenter size-full wp-image-37789"&gt;

&lt;p&gt;Each lens' view has been horizontally stretched, and then stitched into an over/under view. This is in &lt;a href="https://youtube-eng.googleblog.com/2017/03/improving-vr-videos.html"&gt;Google's Equi-angular Cubemap&lt;/a&gt; format. Grim!&lt;/p&gt;

&lt;p&gt;There are two options available to you to get the equirectangular version needed to playback easily on Linux&lt;/p&gt;

&lt;h2 id="easy-way"&gt;&lt;a href="https://shkspr.mobi/blog/2021/01/downloading-360-videos-from-youtube-and-playback-in-linux/#easy-way"&gt;Easy Way&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Running &lt;code&gt;youtube-dl -F https://www.youtube.com/watch?v=...&lt;/code&gt; will show you all the formats available.&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-bash"&gt;136          mp4        1280x720   720s 2325k , avc1.4d401f, 30fps, video only, 24.94MiB
248          webm       1920x960   1080s 2375k , vp9, 30fps, video only, 25.53MiB
137          mp4        1920x960   1080s 4127k , avc1.640028, 30fps, video only, 41.92MiB
18           mp4        640x360    360s  705k , avc1.42001E, 30fps, mp4a.40.2@ 96k (44100Hz), 7.63MiB
22           mp4        1280x720   720s 2514k , avc1.64001F, 30fps, mp4a.40.2@192k (44100Hz) (best)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I found that &lt;code&gt;-f 22&lt;/code&gt; worked. And there's a way to test that!&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;ffmpeg -hide_banner -i filename.mp4&lt;/code&gt; then you should see this in the metadata:&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-_"&gt;Side data:
   stereo3d: 2D
   spherical: equirectangular (0.000000/0.000000/0.000000) 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's the magic which tells a video player that this is a spherical / 360 video.&lt;/p&gt;

&lt;p&gt;If you play back the video in, say, the default Linux video player, it will look like this:&lt;/p&gt;

&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2021/01/Spherical-video.jpg" alt="A distorted video." width="1024" height="554" class="aligncenter size-full wp-image-37788"&gt;

&lt;p&gt;It's a weird view out of both lenses simultaneously. Yeuch!&lt;/p&gt;

&lt;p&gt;But if you play it using &lt;a href="https://www.videolan.org/vlc/releases/3.0.0.html"&gt;VLC version 3 or above&lt;/a&gt;, you'll be able to drag the video around.&lt;/p&gt;

&lt;p&gt;There is a downside. This only gets the 720p version.  If we want the full resolution version, we need a bit more trickery.&lt;/p&gt;

&lt;h2 id="hard-way"&gt;&lt;a href="https://shkspr.mobi/blog/2021/01/downloading-360-videos-from-youtube-and-playback-in-linux/#hard-way"&gt;Hard Way&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;There's &lt;a href="https://github.com/ytdl-org/youtube-dl/issues/15267"&gt;a bug in YouTube which means YouTube-DL sometimes gets served up slightly weird formats&lt;/a&gt;. The fix is to pass a blank user agent:&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-bash"&gt;youtube-dl --user-agent "" ...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, when you download the video, you'll get the full resolution copy in equirectangular format. HORRAY! But without the correct metadata. BOO!&lt;/p&gt;

&lt;p&gt;This is because &lt;code&gt;ffmpeg&lt;/code&gt; strips out Side data. &lt;em&gt;*sigh*&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, run this:&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-bash"&gt;youtube-dl --user-agent "" -k https://www.youtube.com/watch?v=...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That tells YouTube-DL to &lt;code&gt;k&lt;/code&gt;eep the original video and audio separate. They need to be &lt;a href="https://stackoverflow.com/questions/44760588/preserving-side-data-information-for-360-video-transcoding-using-ffmpeg/48147865#48147865"&gt;merged with the standard compliance mode to unofficial &lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-bash"&gt;ffmpeg -i video.mp4 -i audio.m4a -c:v copy -strict unofficial spherical.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Phew! Easy when you know how, eh?&lt;/p&gt;
&lt;img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=37786&amp;amp;HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager"&gt;</content:encoded>
	

					<wfw:commentRss>https://shkspr.mobi/blog/2021/01/downloading-360-videos-from-youtube-and-playback-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
