Encoding High-Resolution 360 and 180 Video for Oculus Go
Oculus Creators Blog
|
Posted by Eric Cheng
|
January 15, 2019
|
Share

Oculus Go is a fantastic VR headset for viewing immersive media. It can decode high-resolution video files (up to 5.7K) that saturate display resolution, providing peak-quality viewing experiences. This article details the process by which high-resolution video files should be encoded to play in Oculus Go.

Although Oculus Go can decode high-resolution video up to 5760x2880 / 30fps in h.264, some encoding workflows can result in the export of files that show visible corruption artifacts when played back in Oculus Gallery, especially when there are long gaps between I-frames.

The reason for these artifacts is due to the motion vector range (mvrange) exceeding levels permissible by the h.264 level 5.2 specification. Video encoders can open mvrange to level 6 [-32768, 32767] when encoding video at the high resolutions that fit into level 6. While the video decoder in Oculus Go allows for resolutions exceeding the level 5.2 spec, it requires that mvrange stay within level 5.2 compliance [-2048, 2047]. ffmpeg allows for level 5.2 mvrange compliance by using the arguments, "-x264-params mvrange=511" (mvrange needs to be under 512 to be in compliance).

The maximum recommended video resolutions for Oculus Go are as follows:

2880x2880 60fps H264 H265

4096x2048 60fps H264 H265

3840x3840 30fps H264 H265

4096x4096 30fps ---- H265

5120x2560 30fps H264 ----

5760x2880 30fps H264 ----

Recommended peak-quality resolutions are:

3D-360:

3840x3840 30fps H264 H265

4096x4096 30fps ---- H265

3D-180 / VR180:

5120x2560 30fps H264 ----

We recommend 5120x2560 for VR180 (2560x2560 per eye) because it will saturate the display resolution in Oculus Go. Playing back higher-resolution video also usually looks great, but at the risk of aliasing.

We recommend encoding videos below 150Mbps for playback in Oculus Go, but lower bitrates are usually preferred to reduce distribution size, and for a safety margin. Regardless of your chosen bitrate for encoding, it's important to test playback in the headset before distribution. Using a "crf" value in ffmpeg along with setting "maxrate" is good practice.

Here's a sample ffmpeg command that will encode VR180 video optimally for Oculus Go (5120x2560 at 30fps), with an arbitrary maximum bitrate of 50Mbps to keep distribution size reasonable. This is usually sufficient for visually-lossless encoding of locked-off (tripod-mounted) shots at 5K, but moving-camera scenes will require much higher bitrates.

ffmpeg -i "input.mp4" -c:v libx264 -preset fast -crf 18 -x264-params mvrange=511 -maxrate 50M -bufsize 25M -vf "scale=5120x2560:out_range=full:out_color_matrix=bt709" -pix_fmt yuv420p -c:a aac -b:a 160k -r 30 -movflags faststart "output.mp4"

Note also that if you're encoding on a machine with many CPU cores, you should include "-threads 16" for libx264 stability. libx265 does not have this stability issue, and can be run without limiting threads (tested on an 18-core machine).

I've provided some sample videos files that illustrate the problem and solution, which can be downloaded here. Sideload the two 5K videos and play them back in Oculus Gallery. You can sideload the files by copying them to your Oculus Go's file system, or you can play them from a media server or Dropbox (using Gallery).

Note that encoding recommendations are different for sharing 360 and 180 videos to Facebook. Please see this article at the Facebook Help Center for more information.