Convert Cubemap to Equirectangular Video with FFmpeg

This guide explains how to convert a 360-degree video from a cubemap format to an equirectangular projection using the powerful v360 video filter in FFmpeg. You will learn the exact command-line syntax, how to handle different cubemap layouts, and how to optimize the output resolution and quality for VR headsets and players.

The FFmpeg v360 Filter Syntax

The v360 filter is the standard tool in FFmpeg for converting between different 360-degree projection formats. The basic syntax requires you to define the input projection, the output projection, and any layout or resolution parameters.

The general structure of the command is:

ffmpeg -i input.mp4 -vf "v360=input_format:output_format:options" output.mp4

Basic Conversion Commands

The commands differ depending on how your input cubemap is structured. The most common cubemap layouts are 3x2 grids and Equi-angular Cubemaps (EAC), which is widely used by platforms like YouTube.

1. Converting a Standard 3x2 Cubemap (c3x2)

If your input video is a standard cubemap packed into a 3x2 grid, use the c3x2 input projection and set the output to equirect:

ffmpeg -i input_cubemap.mp4 -vf "v360=c3x2:equirect" output_equirect.mp4

2. Converting an Equi-angular Cubemap (EAC)

If your video is in the EAC format, use eac as the input projection:

ffmpeg -i input_eac.mp4 -vf "v360=eac:equirect" output_equirect.mp4

Specifying the Face Layout

If the faces of your input cubemap are ordered differently than the FFmpeg default, the output video will look scrambled. You can manually specify the order of the faces using the in_layout parameter.

The default face layout in FFmpeg is right left up down front back (represented as r l u d f b). If your cubemap uses a different layout, specify it like this:

ffmpeg -i input_cubemap.mp4 -vf "v360=c3x2:equirect:in_layout=rludfb" output_equirect.mp4

Common face identifiers are: * r - Right * l - Left * u - Up (Top) * d - Down (Bottom) * f - Front * b - Back

Adjusting Resolution and Quality

Converting projections involves pixel interpolation, which can degrade image quality if not configured correctly. You can control the output resolution and interpolation algorithm to ensure a sharp image.

Setting Output Resolution

Equirectangular videos should ideally have a 2:1 aspect ratio (e.g., 3840x1920 for 4K). You can set the exact output dimensions using the w (width) and h (height) parameters:

ffmpeg -i input_cubemap.mp4 -vf "v360=c3x2:equirect:w=3840:h=1920" output_equirect.mp4

Choosing an Interpolation Method

By default, FFmpeg uses bilinear interpolation, which can make the output look slightly blurry. For a sharper result, change the interpolation method to cubic or lanczos using the interp parameter:

ffmpeg -i input_cubemap.mp4 -vf "v360=c3x2:equirect:w=3840:h=1920:interp=lanczos" output_equirect.mp4