A Python utility to automate the process of generating screenshots from video files, uploading them to image hosting services, and preparing torrent descriptions with mediainfo. This script is designed to streamline the workflow for content uploaders, especially those sharing on private trackers.
Features • Requirements • Installation • Configuration • Usage • Modifying the Script • Notes • Support
- Takes input as either a single file or a folder
- If folder input: lists video files and asks user to select one
- Generates screenshots at configurable intervals using ffmpeg
- Uploads screenshots to one of 3 image hosts:
- Catbox
- ImgBB
- PtScreens
- Generates mediainfo for the video file
- Creates a torrent file using mkbrr
- Generates a description file with uploaded image URLs and mediainfo
- Stores preferences in a config file for future runs
- Clone the repository:
git clone https://github.com/f-o/upx.git
cd upx- Make a virtual environment (optional but recommended):
python3 -m venv venv
source venv/bin/activate- Install Python dependencies:
pip install -r requirements.txt- (Optional) Add an alias to run the script using the virtual environment.
alias upx='/path/to/upx/venv/bin/python3 /path/to/upx/upx.py'
The config.json file stores your preferences:
{
"num_screenshots": 6,
"screenshot_start_time": 10,
"mediainfo_file": "~/mediainfo.txt",
"description_file": "~/description.txt",
"torrent_output_dir": "~/",
"image_hosts": {
"catbox": {
"name": "Catbox",
"endpoint": "https://catbox.moe/user/api.php",
"userhash": ""
},
"imgbb": {
"name": "ImgBB",
"endpoint": "https://api.imgbb.com/1/upload",
"api_key": ""
},
"ptscreens": {
"name": "PtScreens",
"endpoint": "https://ptscreens.com/api/1/upload",
"api_key": ""
}
},
"description_template": "[size=3]Previews[/size][spoiler]\n[align=center]\n{screenshots}\n[/align]\n[/spoiler]\n\n[size=3]Mediainfo[/size][spoiler]\n[code]{mediainfo}[/code]\n[/spoiler]",
"last_image_host": "",
"last_tracker_name": "",
"last_tracker_announce_url": ""
}- num_screenshots: Number of screenshots to generate (default is 6)
- screenshot_start_time: Time (in seconds) to start taking screenshots (default is 10)
- mediainfo_file: Path to save the generated mediainfo text file
- description_file: Path to save the generated description text file
- torrent_output_dir: Directory to save the generated torrent file
- image_hosts: Configuration for supported image hosts (script will automatically prompt for necessary credentials if not set)
- description_template: A template for the description file, using
{mediainfo}and{screenshots}as placeholders - last_image_host: Stores the last used image host for convenience
- last_tracker_name: Stores the last used tracker name for convenience
- last_tracker_announce_url: Stores the last used tracker announce URL for convenience
Run the script:
python upx.pyAlternatively, if you set up the alias:
upxThe script will:
- Ask which image host to use
- Ask if you want to generate a contact sheet (requires vcsi)
- Ask which tracker you want to create the torrent for (stores announce URL for future runs)
- Ask for a file or folder path
- If folder: ask which single video file to use for screenshots
- Generate screenshots at configured intervals
- Upload screenshots to your chosen host
- Generate mediainfo for the video file
- Generate a description file with uploaded image URLs and mediainfo
- Create a torrent file with the specified announce URL
The code is intentionally made simple to allow for easy modifications. You can easily modify:
- Screenshot count (change
num_screenshotsin config.json) - Screenshot timing (change
screenshot_start_timein config.json) - Upload endpoints in the
config.json - Add new image host functions (add function like
upload_to_newhost()and updateupload_screenshots())
- Temporary screenshot files are stored in a
temp_screenshotsfolder and automatically cleaned up - Mkbrr workers is set to 4 for faster torrent creation, adjust in
create_torrent()if needed - Make sure to have the required tools (ffmpeg, curl, vcsi, mkbrr) installed and in your system PATH for the script to work properly
- This script is based off of an old bash script I wrote for personal use, so there may be some quirks or edge cases that haven't been fully handled. Feel free to contribute improvements!
This project is free and open source.
If you find it useful, please consider supporting the project by donating.

