How to crop widescreen videos using pan-and-scan in mpv?

This article provides a quick guide on how to adjust the pan-and-scan settings in the mpv media player to effectively crop widescreen videos. By utilizing built-in keyboard shortcuts or modifying your configuration file, you can easily remove black bars or zoom into video content to fit your screen’s aspect ratio.

Understanding Pan-and-Scan in mpv

The pan-and-scan feature in mpv allows you to zoom into a video, changing how it fits your display window. When dealing with widescreen videos (like 21:9 or 16:9) on a display with a different aspect ratio, zooming in will crop the edges of the video while filling the screen, eliminating letterboxing or pillarboxing.

Using On-the-Fly Keyboard Shortcuts

The fastest way to change pan-and-scan settings while a video is playing is by using mpv’s default keyboard shortcuts.

Shifting the Cropped Window (Panning)

When you crop a video using zoom, you might cut off important action happening at the edges of the frame. You can pan the cropped window using the following default keys:

Setting a Default Pan-and-Scan Value

If you want mpv to always apply a specific level of cropping automatically when it launches, you can add a line to your mpv.conf configuration file.

Open your mpv.conf file (typically located in ~/.config/mpv/ on Linux/macOS or %APPDATA%\mpv\ on Windows) and add the following command:

panscan=1.0

The value 1.0 will zoom in completely to fill the screen, cropping the excess video. You can adjust this value between 0.0 (no crop) and 1.0 (maximum crop to fit screen) to find your preferred balance.