How to Use transpose_vaapi Filter in FFmpeg

This article explains how to use the transpose_vaapi filter in FFmpeg to perform hardware-accelerated video rotation and flipping. Using the Video Acceleration API (VA-API) offloads the video processing workload from your CPU to a compatible GPU (such as Intel or AMD), resulting in significantly faster render times and lower CPU utilization. You will learn the correct command-line syntax, available direction parameters, and a practical example to get started.

Prerequisites

To use VA-API hardware acceleration, your system must have: * A VA-API-compatible GPU (Intel HD/UHD/Iris Graphics or AMD Radeon). * The necessary VA-API drivers installed on your operating system (typically Linux). * A build of FFmpeg configured with --enable-vaapi and --enable-filter=transpose_vaapi.

The transpose_vaapi Syntax and Parameters

The transpose_vaapi filter accepts a dir parameter to define how the video should be rotated or flipped.

The direction values can be specified as integers or named constants:

Command Example

To use this filter, you must initialize the VA-API hardware device, decode the video into GPU memory, apply the filter, and then encode the video using a VA-API encoder (such as h264_vaapi or hevc_vaapi).

Here is a standard command to rotate a video 90 degrees clockwise:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -vf "transpose_vaapi=dir=clock" -c:v h264_vaapi output.mp4

Command Breakdown