Guides

Producing high-quality 1080p60 video of Oculus Rift DK2 gameplay

Viewers and producers on YouTube have a variety of preferences for how to structure Oculus Rift DK2 virtual reality gameplay content. This post summarizes some of the most popular methods and best practices for how to produce 1080p60 videos of each of them with high image quality. 1080p60 is 1920×1080 at 60 FPS, which is currently the highest-resolution 60 FPS format supported by YouTube (I highly recommend uploading all Rift videos in 60 FPS because they generally involve frequent, fast rotations of the camera).

Note: this guide is focused on video publishing, rather than streaming, which requires different tools. Since this guide went up the unwarpvr tool got support for Gear VR; see release page.

Summary

  • For warped stereoscopic video intended to be viewed in the Rift DK2, directly publish your original 1080p60 recording.
  • For unwarped stereoscopic video, which compromises between viewing in the Rift and monitor viewing, record at 1080p60 or higher and then use ffmpeg-unwarpvr to unwarp.
  • For unwarped monoscopic video, which provides a view similar to monitor-based titles, play and record the game at 1440p60 (2560×1440 at 60 FPS), then use ffmpeg-unwarpvr to generate the 1080p60 monoscopic view.

Example of unwarped monoscopic video at 1080p60.

Warped Stereoscopic View

In this method, the original gameplay footage is preserved including lens distortion correction and chromatic abberation correction, allowing any viewer with a DK2 or compatible viewer to reproduce your full field of view during play by simply running your video full-screen on their DK2 in extended mode. Note that this may lead to VR sickness for some viewers since they don’t have control over movement. It can also be viewed stereoscopically on a monitor using the parallel or wall-eyed viewing technique, but on a monitor it will appear distorted and with chromatic abberation. This method also has the benefit of distinctively signifying that the content is Oculus Rift content.

For recording settings with the OBS software, see this post. You can, if you wish, add a facecam either in one of the corners, or in the middle bottom without interfering too much with how the image will appear in the Rift. The use of a green screen is recommended to further reduce interference. Facecam in middle-bottom produces the least overlap, but also puts more emphasis on the face.

vlcsnap-2015-05-02-07h20m31s101.corner vlcsnap-2015-05-02-07h20m31s101.center

Sample of chromatic abberation correction from far left at 100%:

vlcsnap-2015-05-02-07h20m31s101.chroma

Some games (including Titans of Space, Minecrift, Quake II VR, and vorpX) provide an option to disable chromatic abberation correction. This can make the experience slightly better for monitor viewers and slightly worse for Rift viewers. (It is possible to remove chromatic abberation from a video after-the-fact, without affecting distortion, but this is unimplemented right now in unwarpvr.)

Unwarped Stereoscopic View

My method of choice on my own channel, this method provides a compromise between the needs of those viewing in the Rift DK2 and those viewing on their monitors. For those viewing in the Rift DK2, there is more chromatic abberation and more lens distortion than in the warped method, but the content can still be viewed stereoscopically with correct full field-of-view (FOV). For monitor viewers, there is no chromatic abberation, no black space, and no distortion (straight lines remain straight). They can also view the video stereoscopically using the parallel or wall-eyed method.

To use this method, run and record the app normally. For recording settings with the OBS software, see this post. Then download my ffmpeg-unwarpvr tool. Save it to the location where your videos are. Open a command prompt and use “cd” to change directory to the same location. Use this sample command line as a guide, changing “in.mp4” to the name of your video:
ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=1920:1080 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
vlcsnap-2015-05-02-07h48m02s208.2

As shown above, I recommend placing a thin black bar between the two views, which helps visually break them up in very uniform scenes. You can place a facecam in any corner or in top/bottom center – although it will occlude more gameplay content than in the warped method, it will generally not be visible inside the Rift (watch on your Rift to check this). The quality of this method can be slightly improved (especially in the corners) by recording the gameplay at 1440p, as outlined in the unwarped monoscopic method below.

Because the FOV of Rift content is high, you may notice rectilinear perspective distortion (stretching of areas near the corners). The same effect occurs in monitor-based games when raising FOV settings. If you are disturbed by this effect, you can mitigate it by either using the warped stereoscopic method or by using scale_width and scale_height parameters larger than 1, which effectively crop and zoom the video to the central area:
ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=1920:1080:scale_width=1.3:scale_height=1.3 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4

vlcsnap-2015-05-02-08h14m42s75.lowfov
However, this will also reduce image quality; to counter this, recording at 1440p is recommended (see below); this was done for the above screenshot. It will also make the content appear incorrectly inside the Rift (the viewer will have correct stereoscopy but will feel as though they are looking through binoculars).

Unwarped Monoscopic View

This method provides an experience similar to watching recorded gameplay of a normal, monitor-based game. It cannot be viewed in the Rift (except using a 2D video player software like Virtual Desktop) and will only be identifiable as Rift content based on subtle cues. The use of a facecam or logo to emphasize that the content is VR is recommended. This approach is the most representative of your real experience in the Rift (where you observe only a single unified view that is focused on the central area), and is the most comfortable to view on a low field-of-view player, like a non-fullscreen video in a window, or on a mobile device.

However, the use of only one eye view massively reduces resolution; as such, we will need to boost the resolution at which we record the gameplay. We walk through the steps of doing this below.

Add 1440p Custom Resolution

To run any game at 1440p, first you need to add a 2560×1440 resolution mode to your Oculus Rift DK2 display. To do this on an NVIDIA card:

  1. Make sure the Oculus Runtime has been installed and you have rebooted since installing it. Right-click the Oculus icon in your system tray and choose Rift Display Mode. Choose “Extend Desktop to the HMD”.
  2. Switch to Extend Mode by holding the WINDOWS key and pressing P until “Extend” is selected.
  3. Open NVIDIA Control Panel.
  4. Click Display→Change resolution, then your Oculus Rift DK2 display.
  5. Click the “Customize…” button under “2. Choose the resolution”.
  6. Click “Create Custom Resolution…”
  7. Create a 2560×1440 mode as shown in the screenshot below (if you are flicker-sensitive, you may prefer to use a refresh rate of 75 – I prefer using 60 Hz so that I can reserve more system resources for recording).
    523af6da76fca2b5e53d2cc304e42dd4[1]
    Note: Although I use 2560×1440 in this tutorial, any resolution with a 16:9 ratio can be used; the highest I’ve used successfully is 3328×1872. You can also use a lower resolution if you have performance issues at 2560×1440.
  8. Click the Test button. Ensure that your DK2 display is displaying correctly and is not black or distorted. Find the confirmation dialog (it may be on your Rift DK2 display) and click “Yes” or press ALT+Y.
  9. Right-click your desktop and choose Screen resolution. Click the Oculus Rift DK2 display and then select a resolution of 2560×1440. Then click OK. You must use the Windows settings to do this, not NVIDIA Control Panel.
    b634d3e47b0f41fe2224cc70ccf3e0d2[1]

I don’t have an AMD card – if you do and know how to do this on AMD or any other non-NVIDIA card, please tell me how in the comments and I’ll add it here.

Configure Your Game to Run at 1440p

Configure your game to run fullscreen at 2560×1440. The way to do this varies from game to game:

  • Most Unity games: Hold ALT while launching the game. The resolution selector dialog will pop up and allow you to choose 2560×1440. In some Unity titles you may have to run them from the command line like this:
    whatever_DirectToRift.exe -screen-width 2560 -screen-height 1440
    0d4df62b33361c5bc05ab8423d8f73de[1]
    If the game is running in high persistence mode (bright screen, blur during head movement), exit, run and exit the Tuscany application from Oculus, and then try it again.
  • Minecrift: I assume you’ve already set up Minecrift to play at normal 1080p resolution. Next, set your Rift as your main monitor in your Windows resolution settings. Start Minecraft and click “Play game” by looking with one eye in your Rift. Press F11 to go fullscreen. At the main menu click Options→Video Settings→Other and click “Fullscreen Mode” until 2560×1440 is selected.

    vlcsnap-2015-05-02-04h55m49s153
    If the game is running in high persistence mode (bright screen, blur during head movement) toggle the Low Persistence setting in VR Settings→Stereo Renderer to fix it.
  • Other games: If you’re lucky, some games will simply start up in whatever resolution the display is currently set to. If this doesn’t work, check your in-game menus for any resolution options. Many games unfortunately disable resolution options in VR mode.
    If you can’t figure out how to set up your game for 1440p, the rest of this guide will still work fine, but I highly recommend you use one of the approaches in the “Increasing vertical field-of-view” section below, which will reduce the amount of scaling that occurs during unwarping. If you have a particular game you want me to investigate how to run in 1440p, ask in the comments below!

Set Up Recording for 1440p and Test

My recommended settings for OBS are in this post. To adjust for 1440p, go to Settings→Settings→Video and change the resolution under “Custom”. If your gameplay does not correctly fill the recorded video, you may have to right-click on your capture source under “Sources” and choose Position/Size→Fit to screen.

Test: Make sure you can record a video at 1440p60. Make sure the resolution and frame rate on the video file are correct (right-click→Properties→Details). Take a snapshot of a frame (Video→Take Snapshot in VLC) and zoom in on it in an image editing software. Make sure the quality is reasonable – if it looks blocky or blurry, you may need to look for a setting in your application to increase render target resolution, sometimes referred to as render scale, render texture scale, Oculus quality, or VR quality.

Unwarp to 1080p Monoscopic

Download my ffmpeg-unwarpvr tool. Save it to the location where your videos are. Open a command prompt and use “cd” to change directory to the same location. Use this sample command line as a guide, changing “in.mp4” to the name of your video:
ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=1920:1080:left_eye_only=1:scale_width=1.8:scale_height=1.8 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
This will generate a view with no distortion or chromatic abberation that completely fills the 1080p frame:

vlcsnap-2015-05-02-04h14m59s38

Under close inspection, the image is not perfect – it will have a little bit of “fuzziness”, especially near the edges, and there are subtle “ghosts” from the chromatic abberation:

vlcsnap-2015-05-02-04h14m59s38.cropped

If your application supports disabling chromatic abberation correction (like e.g. Titans of Space, Minecrift, Quake II VR, vorpX), you can use this option together with the “chroma_in=0” option in ffmpeg-unwarpvr 0.2.2 or later to eliminate ghosting/fringing from chromatic abberation. You will see more chromatic abberation during recording, but otherwise there is no disadvantage. A monoscopic 1080p sample produced using this method:

ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=1920:1080:left_eye_only=1:scale_width=1.8:scale_height=1.8:chroma_in=0 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4

Sample at 100% zoom with chroma_in=0 option. Chromatic abberation ghosts are removed, but there is still some aliasing.
Sample at 100% zoom with chroma_in=0 option. Chromatic abberation ghosts are removed, but there is still some aliasing.

Additionally, supersampling can be used to address aliasing artifacts. It works by doubling the output resolution of the unwarpvr filter, then downscaling with a scale filter. Warning: this may greatly slow encoding.  Sample command line (the sws flags improve scaling quality):

ffmpeg-unwarpvr -i in.mp4 -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -vf "unwarpvr=3840:2160:left_eye_only=1:scale_width=3.6:scale_height=3.6 , scale=1920:1080" -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4

supersampling2
Comparison with and without supersampling at 300% zoom. Both are still affected by chromatic abberation artifacts, but aliasing is greatly reduced.

Where the application permits, the chroma_in=0 method can be combined with supersampling for the maximum possible image quality:

ffmpeg-unwarpvr -i in.mp4 -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -vf "unwarpvr=3840:2160:left_eye_only=1:scale_width=3.6:scale_height=3.6:chroma_in=0 , scale=1920:1080" -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4

Sample at 100% zoom. Chromatic abberation ghosts are gone, and aliasing is lessened. There are still video encoding artifacts and a little wobbling around edges.
Sample at 100% zoom. Chromatic abberation ghosts are gone, and aliasing is lessened . There are still video encoding artifacts and a little wobbling around edges.

Increasing Vertical Field-of-View

Because the aspect ratio of the view in the Rift is roughly 1:1, cropping it to a 16:9 frame like above results in a dramatic reduction of vertical field-of-view (FOV) that is not representative of your Rift experience.

An approach to mitigating this is to add video content on the left or right sides of the gameplay content, and then reduce the scale_width and scale_height parameters correspondingly. For example, if you add 300 pixels of content on the left-hand side, reducing the resolution to 1620×1080, then the scale factors will be reduced from 1.8 to 1.8×1620/1920 = 1.52. Below is the command line and result (changes in bold):
ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=1620:1080:left_eye_only=1:scale_width=1.52:scale_height=1.52 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
out8.mp4_snapshot_00.06_[2015.05.02_06.42.24].2

In addition to providing a more representative view, this also decreases the amount of scaling which improves image quality.

Here is a more extreme example with 480 pixels removed from both sides, achieving a ratio of 8:9 which has maximum image quality and vertical FOV and minimal cropping of the recording:
ffmpeg-unwarpvr -i in.mp4 -vf unwarpvr=960:1080:left_eye_only=1:scale_width=0.9:scale_height=0.9 -c:a copy -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
out9.mp4_snapshot_00.07_[2015.05.02_06.53.55].2

When the scale factors get this low, recording at 1440p is no longer essential for achieving good quality; you can record even at 1080p and get decent results.

Finally, if you have two players together in a multiplayer game, you can separately record and transform both their views as in the last example above, and then simply put them side-by-side in your video editing software, as below. The result is similar to the stereoscopic view. Again, for clarity I recommend placing a thin black bar between the two views:

out9.mp4_snapshot_00.01_[2015.05.02_07.04.56].3

Conclusion

I hope this has been helpful! I’m eager to see the community of VR gameplay content producers grow, and hopefully this will help you all get started and/or improve the image quality of your videos. Let me know in the comments below if you have any questions or suggestions for expanding this article!

Advertisements

4 thoughts on “Producing high-quality 1080p60 video of Oculus Rift DK2 gameplay

  1. Hey there,

    I’d desperately need your help, because I just can’t get the recording to work. My problem is that I run into issues with the extended mode. I set my Rift to primary display but the apps will always open on my 2nd display, my monitor. I have no idea why this is happening. Switching things up doesn’t help either, because it seems that I can’t record my second monitor with OBS. No matter what I try, it always seems wrong. 😦

    I successfully recorded games with the Nvidia Shadowplay feature, but that is a limited feature.

    Thank you!

    Like

  2. Hey there,

    I got it working with VR gamemanager. However, I get a lot of judder. My system is as follows:

    i5 2500k @4.2GHZ
    970 @980
    8 GB Ram

    I’m trying to record with OBS but as soo as I start the recording, I get significant stutter. I am now trying to find out what is the reason for that or if it’s just the performance impact of the recording and it can’t be any better. The weird thing is, that often the recording is fine and smooth the first few seconds and then the judder begins. Also, lowering the settings, say 720/30FPS instead of 1080/60 doesn’t seem to affect the issue at all. In both cases there is the same amount of judder.

    Any idea where this comes from and what to do against it?

    Like

  3. The weird thing is: I get barely any usage on my CPU even while recording. It’s at 40% max. So it can’t be a lack of power I guess.

    Like

  4. So one more thing I found out: If I use shadowplay and I activate desktop recording and record the mirror that is sometimes shown on the desktop for some apps, I get perfectly fine 60FPS recordings at highest quality settings without the SLIGIHTEST stutter in the oculus game. So it’s definitly not an performance issue. I have no idea what issue it is though.

    I don’t even know if you are answering question, doesn’t seeom so! 😀

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s