Convert Equirectangular to Cubemap with FFmpeg
This guide explains how to convert 360-degree spherical video from an
equirectangular format to a cubemap projection using FFmpeg's built-in
v360 filter. You will learn the core command-line syntax,
the most common cubemap output layouts, and how to adjust dimensions to
preserve visual fidelity.
Understanding the v360 Filter Syntax
The v360 filter handles geometric transformations for
360-degree media. When converting from equirectangular to cubemap, you
need to define the input projection format (input or
in) and the output projection format (output
or out).
- Equirectangular input alias:
equirectangularore - Cubemap output options:
c3x2: A 3x2 grid layout (the most widely used standard for streaming and VR).c6x1: A 6x1 horizontal strip.c1x6: A 1x6 vertical strip.eac: Equi-Angular Cubemap (a variation that distributes pixels more evenly).
Basic Conversion Command
To convert an equirectangular video to a standard 3x2 cubemap layout, run the following command:
ffmpeg -i input_equirectangular.mp4 -vf "v360=e:c3x2" -c:v libx264 -crf 18 -c:a copy output_cubemap.mp4In this command:
-i input_equirectangular.mp4specifies the source video.-vf "v360=e:c3x2"applies the video filter, setting the input projection to equirectangular (e) and the output projection to a 3x2 cubemap (c3x2).-c:v libx264 -crf 18re-encodes the video using H.264 at a visually near-lossless quality level.-c:a copycopies the audio stream without re-encoding.
Controlling Output Resolution
By default, FFmpeg determines the output resolution automatically based on the input stream, but specifying the dimensions manually prevents blurriness and uneven face sizing.
For a 3x2 cubemap, each cube face is square. If each face is set to 1024x1024 pixels, the total canvas width is 3072 (3 × 1024) and the height is 2048 (2 × 1024).
ffmpeg -i input_4k.mp4 -vf "v360=e:c3x2:w=3072:h=2048" -c:v libx264 -crf 18 output_cubemap_3072x2048.mp4w=3072: Sets the total output width in pixels.h=2048: Sets the total output height in pixels.
Customizing Cube Face Order and Orientation
Different VR players and game engines expect cube faces to be laid
out in specific orders or rotated in specific directions. You can
control this using the out_forder and out_frot
parameters.
The face identifiers are:
r: Rightl: Leftu: Up (Top)d: Down (Bottom)f: Frontb: Back
To rearrange the layout to a custom order:
ffmpeg -i input.mp4 -vf "v360=e:c3x2:out_forder=rludfb" -c:v libx264 -crf 18 output.mp4To rotate individual faces, pass rotational values (in multiples of
90 degrees: 0, 1, 2, or
3) to out_frot:
ffmpeg -i input.mp4 -vf "v360=e:c3x2:out_forder=rludfb:out_frot=000000" -c:v libx264 -crf 18 output.mp4Converting to Equi-Angular Cubemap (EAC)
Equi-Angular Cubemaps alter the pixel distribution across each cube face to reduce distortion at the edges and corners, which improves clarity in VR head-mounted displays.
ffmpeg -i input.mp4 -vf "v360=e:eac:w=3072:h=2048" -c:v libx264 -crf 18 output_eac.mp4