Skip to main content
Encoding

Encode Your Frames to Video

Turn rendered 360 and 180 frames into a video: ffmpeg, joining stereo eyes, Premiere Pro export and exporting after grading.

Last updated About 4 hours ago

This article covers turning your rendered frames into a video file you can deliver: which frames to encode, encoding with ffmpeg, joining separate eye files into one video, exporting from Premiere Pro, and exporting after you grade. For the metadata headsets and online players need to play the video as 360 or 180, see 360 and 180 Metadata.

Why Render Frames, Then Encode

  • Render image frames from Movie Render Queue or Movie Render Graph, then encode them to video. This lets you render larger than H.264 allows (4096 x 4096), choose a codec your player supports, and add the metadata headsets and online players need to play the video as 360 or 180.

  • For which frame format to render, see Output File Formats.

Which Frames to Encode

  • To encode EXR frames straight to video, render them with Disable Tone Curve unticked.

  • ffmpeg cuts EXR values above 1.0 to white, so an EXR rendered with Disable Tone Curve ticked loses its highlights in the video. For a graded delivery, grade the Disable Tone Curve EXR files in software that reads them directly, such as DaVinci Resolve or Nuke, then encode from that (see Export After Grading below).

  • When you encode EXR frames with ffmpeg, put -apply_trc iec61966_2_1 before -i, or the video comes out too dark.

Encode with ffmpeg

You must install FFMPEG to use it in the command line.

FFmpeg is a leading free, open-source multimedia framework designed to decode, encode, transcode, mux, demux, stream, filter, and play nearly any audio or video format.

For example, below shows how to encode your saved stills to video using a wider range of formats and color spaces than h.264.

  1. Navigate to the render output folder and type CMD to bring up the Windows Terminal in the File Directory where you have saved your rendered files.

  2. Paste the below command into the terminal and press enter.

    1. It can help to redraft and save the command in notepad, changing any parameters that are unique to your own PC or render, such as the file names, frame numbers and output path.

ffmpeg -f image2 -framerate 60 -start_number 500 -apply_trc iec61966_2_1 -i "LS_DrivingPlate.%04d.exr" -frames:v 200 -vf "scale=8192:4096:flags=lanczos,format=yuv420p10le" -c:v libsvtav1 -preset 8 -crf 22 -color_primaries bt709 -color_trc bt709 -colorspace bt709 "F:\OWL\Renders\360\ffmpeg\DrivingPlate180.mp4"

What the Command Does

ffmpeg -f image2: Starts ffmpeg and tells it the input is a numbered image sequence.

-framerate: The frame rate the image sequence plays at. The video file uses the same rate.

-start_number 500: The number of the first image to read. Images with lower numbers are skipped.

-apply_trc iec61966_2_1: Converts the EXR's linear color with the sRGB curve, so the video matches Unreal's own PNG and JPG output. Without it the video comes out too dark.

-i "LS_DrivingPlate.%04d.exr": Finds any files with the name LS_DrivingPlate.exr and with four integers to label the frame number.

-frames:v 200: How many images to put in the video, counting from the start number.

-vf: Video Filters

"scale=8192:4096:flags=lanczos,format=yuv420p10le": Resizes every frame to 8192 x 4096 with the Lanczos filter, which keeps detail sharp, then converts it to 10-bit color (yuv420p10le), which gives smoother gradients than 8-bit.

-c:v libsvtav1: The encoder: SVT-AV1, which makes AV1 video, a high quality compressed format.

-preset 8: The encoding speed. Lower numbers encode more slowly but give better quality for the same file size. It doesn't change how fast the video plays back.

-crf 22: (Constant Rate Factor) The quality level, from 0 to 63. Lower numbers give higher quality and bigger files. It gives more data to busy, fast-moving shots and less to still ones, so the quality stays even.

-color_primaries bt709 -color_trc bt709 -colorspace bt709: Labels the video as Rec. 709, the standard color space for online video. These flags only label the file. They don't convert the color, which is what -apply_trc does.

"F:\OWL\Renders\360\ffmpeg\DrivingPlate180.mp4": The final output directory for the video file.

Join Separate Eyes into One File

To join Separate Eyes files into one Top-Bottom video, stack the left eye on top of the right:

ffmpeg -framerate 60 -apply_trc iec61966_2_1 -i "Shot_L.%04d.exr" -framerate 60 -apply_trc iec61966_2_1 -i "Shot_R.%04d.exr" -filter_complex "[0:v][1:v]vstack=inputs=2,format=yuv420p10le" -c:v libx265 -crf 18 "Shot_TB.mp4"
  • For Side-by-Side (left eye on the left), use hstack instead of vstack.

  • Then add the stereo metadata (see 360 and 180 Metadata).

Add the 360 or 180 Metadata

ffmpeg doesn't add the metadata that tells YouTube and VR players a video is 360 or 180, so they play it as a flat video. Add it afterwards with Google's Spatial Media Metadata Injector: see 360 and 180 Metadata.

Export from Premiere Pro

  • In Premiere Pro, right click in a project's Bin and select Import, select this first image in an image sequence, ensure Image Sequence is ticked and click Import.

  • Check the Frame Rate is correct using Modify > Interpret Footage:

    • Select an Assumed Frame Rate of whatever you have rendered at in Unreal.

  • Right click on the sequence and select New Sequence from Clip.

  • Use File > Export Media to bring up the Export Tab. For example, you can follow the steps below for Quest 3 (the screenshots show example values):

    • Create a new preset and ensure it is set to Custom. Set the format to the Codec for your headset in Headset Delivery Settings. For Quest 3, use HEVC (H.265), which plays well at high bitrates; AV1 is also suitable:

    • Set the resolution and frame rate to the values for your headset. For Quest 3 that is 5760×5760 at 60 fps for stereo 360, or 8192×4096 at 60 fps for mono:

    • Set the Encoding settings to Hardware Encoding for the fastest rendering, Main 10 Profile for 10-bit color and Level 6.1 as a performance constraint for 8k video:

    • Set the Target Bitrate to the value for your headset (120-180 Mbps for Quest 3).

    • Set the VR Metadata to match your 360 format. Stereoscopic Side by Side with a 180 Horizontal and Vertical field of View is suitable for VR 180 format. For Equirectangular ODS (VR 360), use Stereoscopic Over/Under with 360 by 180. Match the eye order to the camera's Layout: VR 180 defaults to Side-by-Side (Left Eye on Left), and Equirectangular ODS (VR 360) to Top-Bottom (Left Eye on Top).

Export After Grading

  • Export the graded film from your grading software as an image sequence or a high-quality master such as ProRes, then encode it for where it plays.

  • For headsets, use the values in Headset Delivery Settings. For domes, ask the venue for its playback specification (see Deliver to Domes).

  • ffmpeg clips values above 1.0, so encode from the graded export, not from Disable Tone Curve EXRs.