mpv-lines-meme-generator for Windows
April 16, 2025 ยท View on GitHub

This script allows users to take screenshots in MPV, crop them to keep only the bottom portion, and stitch them together into a long vertical image, just like a meme of lines. It is designed for Windows operating systems and requires ffmpeg to function.
Features
- Take multiple screenshots with the press of a key.
- Crop the bottom portion of the screenshots to create a unified long image with customizable location.
- Stitch all cropped images together into a single output image.
- Option to save screenshots in lossless
.pngformat for higher quality or.jpgformat for smaller file size. - Customizable directory for saving images and height of cropped sections.
Dependencies
- MPV Media Player
- FFmpeg (ensure it is in your system's PATH)
Installation
- Ensure you have MPV and FFmpeg installed on your system.
- Copy the script into your MPV scripts directory, typically found at:
C:\Users\<YourUsername>\AppData\mpv\scripts\
- Edit the script to set the desired screenshot directory, cropping arguments, whether to save images in lossless format and ffmpeg log level.
- Restart MPV.
Usage
-
Key Bindings:
- Press
nto take a screenshot (can be pressed multiple times). - Press
Ctrl+nto create the stitched image from the taken screenshots. - Press
Alt+Up/Downto increase/decrease the top margin of the subtitles. - Press
Alt+Left/Rightto increase/decrease the bottom margin of the subtitles. - Press
Alt+mto toggle the mouse position ratio display in order to show the position intuitively.
- Press
-
Configuration:
- Update the
diroption in the script to specify the directory where screenshots will be saved. - Adjust the
subtitle_topandsubtitle_bottomoption to set the top/bottom margin of subtitles to keep (height from the bottom). - Set the
losslessoption totrueif you want lossless PNG images, orfalsefor compressed JPEG images. - Set the
ffmpeg_logleveloption to select the appropriate logging level to avoid ffmpeg outputting too many log records. (ffmpeg log level: quiet, panic, fatal, error, warning, info, verbose, debug)
- Update the
Note: Using the lossless option will significantly increase the time it takes to process and stitch images due to the larger file size and processing requirements of PNG files.
Example Configuration
local options = {
dir = "C:/Users/YourUsername/Documents/mpv/screenshots",
subtitle_top = 0.15, -- Set 15% (of video height) to the top of subtitles
subtitle_bottom = 0, -- Set the bottom to the bottom of subtitles
lossless = false, -- Save screenshots as JPG for lower processing time
ffmpeg_loglevel = "error", -- Only output error and fatal logs
}
Acknowledgments
- Original concept and code by Wanakachi.
- Thanks to Dai-JiaLin -- submitted PR #1, which added the ability to freely adjust the cropping height.
Troubleshooting
- If you encounter issues with the script, ensure that the paths are correctly set and that
ffmpegis accessible from the command line. - Check the MPV log for error messages related to the script.