Share Your Spherical Panorama as a VR Video

NASA/JPL’s recent posting of the first Mars panoramic view from the Perseverance rover brought me back to some experimentation I had been doing a few years ago with spherical (360x180 degree) panoramic photos. Standardized viewers for interactively viewing panoramas aren’t readily available even today, but one option for sharing is to post a video on YouTube.

When you start the panoramic video, at first glance, the spherical panorama video is completely static, but on a computer, if you move your mouse cursor into the frame, it changes to a hand icon, which allows you to click and drag around your viewpoint. To give you more time before the video ends, the video can be paused while you take your time browsing the scene.

Try expanding to full-screen, and setting the resolution to the maximum 4K resolution (2160s). This allows you to use the mouse scroll wheel to zoom in for a closer look on a system with less than a 4K display. On a Chromebook, you may have to hold the shift key down when using the mouse scroll wheel to keep the image window in place.

On a phone or tablet equipped with accelerometers, you can browse the scene in virtual reality (VR) by simply pointing your device in a different direction.

So How Do We Do This for Our Own Shots?

Background

To begin, we should have an equirectangular image from a spherical panorama camera or the output of a stitching software package such as PTGUI. You can also create this file with a cellphone camera. On Android phones, you can produce a photosphere (Google's name for a spherical panorama). This can then be downloaded from your Google Photos library as a correctly proportioned 1:2 equirectangular JPG file. 

However you created the spherical panorama, the image is in a standard 1:2 aspect flat image format such as TIFF or JPG. The equirectangular mapping puts the zenith of the camera at the top of the frame, and the nadir point at the bottom of the frame. The 360-degree horizontal extent is spread from left to right, with the left and right sides wrapping around, so the raw panorama is distorted, just like a Mercator map of the Earth. If you have a blank area at the top or bottom of your image, then you will have a hole above or below you in the image (as in the Yerkes Observatory example above).

The problem with this file is that any image viewer you use must find some special metadata embedded in the file to recognize it as a spherical panorama. The procedure below first uses Photoshop to correctly size the image for 4K video and change the aspect to 16:9. Photoshop is then used to create a video file from the single frame. Finally, a separate special program adds the metadata to the video file so the video player recognizes it as a spherical panorama instead of a flat video.

Procedure

  1. Start by opening your standard 1:2 formatted full equirectangular image in Photoshop. 
  2. Downsize the image to 4K resolution (3480x2160 pixels, 16:9 aspect ratio). Note: Unlink the width and height settings before doing this to avoid distortion. 
  3. Open the Photoshop Timeline Window and use the Create Video Timeline function in the window to convert the panorama into a video.
  4. Stretch the video duration to 20 to 30 seconds to give the viewer time to pause the video playback and browse the image.
  5. Use Photoshop’s File > Export > Render Video function to write out a 4K mp4 video.

At this point, you have a playable video file, but it’s not marked as being a spherical panorama. To insert the correct metadata, the going gets a bit rough. You need to use a Google open-source project called Spatial Media Metadata Injector. The relevant program is a Python script, but first, Python 2.7 (not 3.x) itself must be installed into your system.

On a Windows 10 system, once you have Python 2.7.16 (current as of this writing), unzip the downloaded spatial-media-2.0.zip package. For the following procedures, run these inside a command prompt (CMD) window:

  • [python path]\python setup.py
  • [python path]\python spatialmedia -i [InputFile] [OutputFile]

The first command only needs to be run once after unzipping the package. The second command is used each time you want to convert a file. Run this command from inside the directory created for the downloaded software and fill the bracketed items with your own file names. For example, I run mine as:

c:\python27\python spatialmedia -i [InputFile] [OutputFile]

If all this sounds too complicated for you, offer your local computer geek a coffee to get everything set up on your system. I’m hoping that in the not-too-distant future, Photoshop will include an option to directly export a spherical panorama video. Other options are available in pro-level video programs, but for casual photographers, this is one way to go for no extra cost.

Once the metadata has been inserted, the video can be viewed locally in the Windows 10 Movies and TV player app with panning enabled. The video can also be viewed in the popular VLC media player. If all is well, the file is now ready for upload to YouTube. Have patience as the 4K video will take some time to be processed before it’s available on the service at full resolution.

How About Vimeo?

Yes, the procedure does also work on Vimeo, though the controls are slightly different. The mouse scroll wheel does not do anything. Here's a Vimeo sample:

Pros and Cons?

The current YouTube (and Vimeo) viewer is a bit clumsy in having to handle panoramas as videos. This approach definitely feels like a square peg has been pounded into a round hole. A consequence of this is that reaching the end of the video causes the video and your image browsing to end. 

And finally, currently both YouTube and Vimeo support a maximum of 4K resolution, and thus can't show us the full detail of the source image, which typically has more than two times the resolution in each axis. 

On the other hand, for photographers, it’s a no-cost way of sharing spherical panoramas without hosting your own website with specialized panoramic viewer software. It’s a little pain upfront, but you are potentially reaching many more viewers. Follow NASA’s lead. Their video has over 6 million views as of this writing!
 

Log in or register to post comments