https://github.com/samillion/mpv-boxtowide
A simple mpv script to change 4:3 aspect-ratio of video files/streams to 16:9 automatically.
https://github.com/samillion/mpv-boxtowide
mpv mpv-player mpv-script
Last synced: 8 months ago
JSON representation
A simple mpv script to change 4:3 aspect-ratio of video files/streams to 16:9 automatically.
- Host: GitHub
- URL: https://github.com/samillion/mpv-boxtowide
- Owner: Samillion
- License: agpl-3.0
- Created: 2018-06-06T23:24:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-17T19:03:16.000Z (over 1 year ago)
- Last Synced: 2024-11-20T20:39:11.870Z (over 1 year ago)
- Topics: mpv, mpv-player, mpv-script
- Language: Lua
- Homepage:
- Size: 3.42 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## mpv-boxtowide

This script detects if a video has a 4:3 aspect ratio and automatically adjusts it to 16:9 (wide).
It is designed for libraries with older 4:3 content, stretching them to 16:9 without manual intervention. The script aligns with my preference for a simple [mpv configuration](https://github.com/Samillion/mpv-conf) to fit this straightforward use case.
## Options
To adjust options, simply change the values inside `local options` within the script.
```lua
local options = {
-- target aspect ratio for conversion
target_ratio = "16:9",
-- usually 4:3 would only need 1.3333
-- many old videos use weird ratios, this min/max range covers most of them
min_ratio = 1.28,
max_ratio = 1.39,
-- file extensions the script will do a ratio check on
video_exts = {
"3g2", "3gp", "asf", "avi", "f4v", "flv", "m2t", "m2ts", "m4v", "mj2",
"mkv", "mov", "mp4", "mpeg", "mpe", "mpg", "mts", "ogv", "rmvb", "ts",
"webm", "wmv", "y4m"
},
-- regex to detect urls (for ytdl videos)
url_pattern = "^%a+://",
}
```
## How to install
Simply place `boxtowide.lua` in the corresponding mpv scripts location of your operating system:
- Windows: `%APPDATA%\mpv\scripts\` or `C:\users\USERNAME\AppData\Roaming\mpv\scripts\`
- Linux: `~/.config/mpv/scripts/` or `/home/USERNAME/.config/mpv/scripts/`
- Mac: `~/.config/mpv/scripts/` or `/Users/USERNAME/.config/mpv/scripts/`
> [!NOTE]
> More information about files locations can be found [here](https://mpv.io/manual/master/#files)
```
config/mpv
│ input.conf
│ mpv.conf
│
└───scripts
boxtowide.lua
```