Convert Dual Fisheye 360 Video to Flat Using FFmpeg
This article provides a direct guide on converting raw dual-lens
fisheye 360-degree video into a standard flat (rectilinear) perspective
using FFmpeg’s v360 filter. By defining the input
projection, selecting a flat output, and adjusting the field of view and
viewing angles, you can reframe your panoramic footage into a standard
video suitable for standard screens without dedicated 360 players.
The Basic Conversion Command
Dual-lens 360 cameras capture two circular fisheye images side-by-side. To convert this layout into a standard, flat perspective, use the following FFmpeg command:
ffmpeg -i input_dual_fisheye.mp4 -vf "v360=dfisheye:flat:h_fov=100:v_fov=60:yaw=0:pitch=0:roll=0:w=1920:h=1080" -c:v libx264 -crf 18 -c:a copy output_flat.mp4Key Parameter Explanations
The v360 filter relies on specific key-value pairs
separated by colons:
- Input Projection (
dfisheye): The first parameter specifies the input format.dfisheyetells FFmpeg that the video consists of dual fisheye lenses side-by-side. - Output Projection (
flat): The second parameter designates the target format.flatproduces a rectilinear perspective (the standard perspective used by conventional video cameras). - Field of View (
h_fovandv_fov): Sets the visible area in degrees.h_fov=100: Sets the horizontal field of view to 100 degrees.v_fov=60: Sets the vertical field of view to 60 degrees.- Note: Setting these values too high can cause stretching at the edges of the frame, while setting them too low creates a heavily zoomed-in effect.
- Camera Orientation (
yaw,pitch,roll): Controls the direction the "virtual camera" points.yaw: Rotates the camera horizontally (-180 to 180). Use this to choose which lens or direction to face.pitch: Tilts the camera up or down (-90 to 90).roll: Rotates the camera around the view axis (-180 to 180) to level a tilted horizon.
- Output Dimensions (
wandh): Sets the resolution of the output frame (e.g.,w=1920:h=1080for standard 1080p).
Fine-Tuning Lens Coverage
Most dual-lens cameras have an individual lens coverage slightly
greater than 180 degrees (often 190° to 200°) to allow for image
stitching. If the default dfisheye mapping creates edge
distortion or warping:
ih_fovandiv_fov: Define the input horizontal and vertical field of view per fisheye circle.
ffmpeg -i input.mp4 -vf "v360=dfisheye:flat:ih_fov=195:iv_fov=195:h_fov=90:v_fov=60:w=1920:h=1080" -c:v libx264 -crf 18 -c:a copy output.mp4Selecting the Target Lens
If your subject was recorded by the rear lens rather than the front
lens, rotate the view by 180 degrees using the yaw
parameter:
ffmpeg -i input.mp4 -vf "v360=dfisheye:flat:yaw=180:h_fov=90:v_fov=60:w=1920:h=1080" -c:v libx264 -crf 18 -c:a copy output.mp4