Configure Yaw Pitch Roll in FFmpeg v360 Filter

This guide explains how to adjust the rotation of 360-degree videos using the yaw, pitch, and roll parameters within the FFmpeg v360 filter. You will learn the definitions of each rotational axis, the correct command-line syntax, and practical examples to reorient your spherical footage without changing its projection format.

Understanding Yaw, Pitch, and Roll

The v360 filter allows you to rotate 360-degree video along three three-dimensional axes. The rotation values are specified in degrees, and positive or negative values dictate the direction of the rotation:

Basic Syntax

To adjust these parameters, you must define the input and output projection formats in the v360 filter. Even if you are keeping the same format (most commonly equirectangular), the filter requires these definitions to apply the rotation.

The basic syntax for rotating an equirectangular video is:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:yaw=Y:pitch=P:roll=R" output.mp4

Replace Y, P, and R with your desired numerical values.

Practical Examples

1. Rotating the Horizon (Yaw)

If the front of your 360-degree video is facing the wrong direction, you can pan the camera horizontally. To rotate the starting view 90 degrees to the right:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:yaw=90" output.mp4

2. Correcting a Crooked Camera (Roll)

If the camera was tilted slightly to the side during recording, you can correct the horizon line. To tilt the video 5 degrees counter-clockwise to level it:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:roll=-5" output.mp4

3. Adjusting the Vertical Angle (Pitch)

To tilt the camera perspective downward by 15 degrees:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:pitch=-15" output.mp4

4. Combining Yaw, Pitch, and Roll

You can combine all three parameters to perform a complex camera reorientation in a single command. The rotation is processed in the order of yaw first, then pitch, and finally roll:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:yaw=45:pitch=10:roll=-5" output.mp4

Optimizing Image Quality During Rotation

Rotating spherical video requires pixel interpolation, which can introduce blurriness. To maintain the highest possible image quality, add the interp parameter to use a high-quality interpolation algorithm like lanczos or bicubic:

ffmpeg -i input.mp4 -vf "v360=input=equirect:output=equirect:yaw=180:interp=lanczos" output.mp4