Capturing video from Meta Quest 2 headsets

Capturing video from Meta Quest 2 headsets

Capture video directly from your Meta Quest 2 headset to use in live streams or in offline video editing work.

Alt text.

Categories:Create & Build
Tags:FormatsHardwareStereoscopicVR Headset
Skill Level:
Intermediate

Updated 12/02/2022

Introduction

Video captured from Meta Quest headsets is commonly used to share what a user experiences to audiences who are not in VR headsets. There are multiple ways to achieve this, both for live streaming a feed and for capturing recorded video for further editing.

Live casting

The simplest method for casting a live stream from your headset is to use the built in web casting feature at http://oculus.com/casting, or by casting to the Meta Quest app on a mobile device.


If you’re willing to enable Developer Mode and plug your Meta Quest into a computer using a USB Link cable, there are more options. [Meta Quest Developer Hub](LINK: https://developer.oculus.com/documentation/unity/ts-odh/) supports one-click casting to a window on a computer. scrcpy is a command line alternative with customization options.

  1. Enable Developer Mode (follow the steps here)
  2. Plug your headset into your computer using a Link cable or other high-bandwidth USB3 cable
  3. Use Meta Quest Developer Hub or scrcpy

The scrcpy command on its own streams a full uncropped view of both eyes (the “screenbuffer”). It doesn’t de-warp the content, so the result is exactly as is rendered in headset before the lenses correct it. For that reason it won’t be suitable for some requirements.


Add the --crop command with a set of numeric values to trim the width, height, and the top and left offset positions of the footage. To pull just one eye out use values such as scrcpy --crop 1832:1500:1832:0. This example sets the width to 1832px and the height to 1500, and using 1832 for the left offset (exactly half the full possible width) will crop the stream to the right eye (this works because the Meta Quest 2 display is 1832x1920 pixels per eye).


Play around with the crop arguments to pull a different rectangle from the output. Audio must be recorded separately, so plan for this as well if that’s important. You can simply use a minijack audio connector in the headset’s headphone socket and whatever audio recording device you prefer at the other end.


If you’d like to record the live stream as well as display it then add --record filename.mp4 or --record filename.mkv to the command line instruction. (The MKV format doesn’t corrupt if the recording is interrupted before being ended.) For example scrcpy --crop 1832:1920:0:0 --record mygame.mp4 will create an MP4 video file of the left eye view in your current directory.


Depending on bitrate settings, the view on screen is delayed more and more over time, but even though the latency for the display increases it doesn’t seem to drop frames, and external audio recording stays relatively in sync over time (but should be tested before recording long sessions).



Finally, if you want to record the action without displaying it then use --no-display in the arguments, for example scrcpy --no-display --record mygame.mp4.

Non-live capture

If your goal is to record high quality footage for non-live streamed uses you can use the built in screen record functionality: press the Home button on your right controller to open the universal menu, select the sharing button, then Record Video. This will include all in-headset sounds, and you can optionally include mic audio for recording your own voice and external environment sounds as well as the headset environment.


What’s captured is a dewarped, non-stereo, rectilinear view with none of the lens projection distortions captured with scrcpy; it is what the user perceives rather than literally what is rendered on the Quest’s displays. By default, recording the screen from inside the headset in this way results in a 1024x1024 video captured at 5Mbps being saved into your /Oculus/VideoShots folder in your headset. You can override the default quality settings using the Advanced Camera Settings, which can be accessed by enabling the feature in Experimental Settings.


Another method of setting advanced camera settings is to by setting the following properties in Developer Mode. (To enable Developer Mode see steps 1 to 3 in the Live Capture section above.)



To change the internal video recording settings plug your Meta Quest headset into your computer and run these adb commands:


adb shell setprop debug.oculus.capture.width 1920

adb shell setprop debug.oculus.capture.height 1920

adb shell setprop debug.oculus.capture.bitrate 30000000


When you next record this will give you a 30Mbps 1920x1920 capture. In post production you can crop the top and bottom creatively to achieve different capture aspect ratios. Alternatively, you can set the width and height to your preferred values right here, for example 1920x1080.


In real-world tests, 15-30Mbps has worked consistently. Audio sync may drift in long sessions, so be sure to test your settings thoroughly.


The real-world maximum capture resolution is very much dependent on what is being captured. If something is pushing the headset’s hardware to the maximum and using the hardware encoder, even 1920px could be more than the capture process will handle. We advise choosing the lowest resolution that fits your needs and be prepared to reduce this further if you have performance issues such as dropped frames.


All these values are reset to the original defaults when the headset is rebooted.

Fixing frame rates

The recorded media is AVC and can have a wildly swinging variable frame rate that video editors such as Adobe Premiere Pro may not like. For example, one of our test captures using scrcpy reported variable frame rates between 8.184 and 192.175fps, with an average of 61.281fps. Internally-recorded video defaults to capturing at or close to 24fps (and can be changed in the Advanced Camera Settings).


You can use ffmpeg to convert to a constant framerate before trying to share or import the footage into an editor. The following command will re-encode the media as h.264 at 60fps. Including -r 60 forces the resulting video to be 60fps:


ffmpeg -i "recording.mp4" -c:v libx264 -preset fast -crf 18 -r 60 -pix_fmt yuv420p -c:a copy -movflags faststart "output.mp4"

Enabling full framerate capture

The following property can be set to enable full framerate internal capture. This has a high likelihood of affecting the performance of VR apps, so use with care. Setting this property back to 0 disables full rate capture:


adb shell setprop debug.oculus.fullRateCapture 1

Stereoscopic capture

It is possible to capture in stereoscopic 3D by setting the following property:


adb shell setprop debug.oculus.screenCaptureEye 2


The resulting video is converged at infinity and needs to be re-converged before playback in most 3D video players.


Here are some reasonable settings for high-quality, stereoscopic internal capture:


adb shell setprop debug.oculus.screenCaptureEye 2

adb shell setprop debug.oculus.capture.width 2160

adb shell setprop debug.oculus.capture.height 1080

adb shell setprop debug.oculus.fullRateCapture 0

adb shell setprop debug.oculus.capture.bitrate 20000000


To get your headset back to reasonable defaults, reboot your headset or use the following commands:


adb shell setprop debug.oculus.screenCaptureEye 1

adb shell setprop debug.oculus.capture.width 1920

adb shell setprop debug.oculus.capture.height 1080

adb shell setprop debug.oculus.fullRateCapture 0

adb shell setprop debug.oculus.capture.bitrate 15000000