How to Set Video Rotation Metadata in FFmpeg

This article explains how to quickly change or set a video’s rotation metadata (such as 90, 180, or 270 degrees) using FFmpeg without re-encoding the video stream. By modifying only the metadata, you can change the playback orientation instantly while preserving the original video quality and saving CPU resources.

To set the rotation metadata without altering the actual video frames, you must use the stream copy mode (-c copy) along with the metadata flag targeted at the video stream (-metadata:s:v).

The FFmpeg Command

Run the following command in your terminal to set the rotation metadata to 270 degrees:

ffmpeg -i input.mp4 -c copy -metadata:s:v rotate="270" output.mp4

Command Breakdown

How to Reset or Clear Rotation Metadata

If you want to clear the rotation flag so the video plays in its default native orientation, set the rotation value to 0:

ffmpeg -i input.mp4 -c copy -metadata:s:v rotate="0" output.mp4

Important Considerations