Skip to content

desaianand1/Emulation-Station-Media-Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ EmulationStation Media Converter

Shell Script Platform Version

A powerful, automated media processing script designed specifically for EmulationStation frontends like ES-DE. Converts and optimizes video game artwork, screenshots, and videos with intelligent compression while maintaining high visual quality.

Tip

Who is this for? Useful for users that add their own media to frontends or gather media for obscure games that don't have entries on Screen Scraper or the Launchbox Database

โœจ Features

  • ๐Ÿ–ผ๏ธ Smart Image Processing: Converts images to standardized PNG format with precise dimensions for each media type
  • ๐ŸŽฅ Intelligent Video Compression: Lossless compression for files under 10MB, quality-focused H.265/H.264 encoding for larger files
  • ๐Ÿ“ Batch Processing: Handles multiple folders simultaneously with progress tracking
  • ๐Ÿท๏ธ Custom File Mapping: JSON-based filename mapping for clean, organized media libraries

๐Ÿ“‹ Requirements

Dependencies

  • ImageMagick - Image processing and conversion
  • FFmpeg - Video processing and compression
  • jq - JSON parsing for filename mappings
  • bc - Mathematical calculations (GNU implicit)

Installation (macOS)

brew install imagemagick ffmpeg jq

Installation (Ubuntu/Debian)

sudo apt update
sudo apt install imagemagick ffmpeg jq bc

๐Ÿš€ Quick Start

1. Clone the Repository

git clone https://github.com/desaianand1/Emulation-Station-Media-Converter.git
cd Emulation-Station-Media-Converter

2. Set Up Directory Structure

โ”œโ”€โ”€ input/
โ”‚   โ”œโ”€โ”€ screenshots/     # Game screenshots (โ†’ 1920x1080 PNG)
โ”‚   โ”œโ”€โ”€ fanart/         # Fan artwork (โ†’ 1920x1080 PNG)  
โ”‚   โ”œโ”€โ”€ titlescreens/   # Title screens (โ†’ 1920x1080 PNG)
โ”‚   โ”œโ”€โ”€ covers/         # Box art covers (โ†’ 420x680 PNG)
โ”‚   โ”œโ”€โ”€ marquees/       # Arcade marquees (โ†’ 600x300 PNG)
โ”‚   โ”œโ”€โ”€ physicalmedia/  # Cart/disc images (โ†’ 500x500 PNG)
โ”‚   โ””โ”€โ”€ videos/         # Gameplay videos (โ†’ MP4, <10MB)
โ”œโ”€โ”€ output/             # Processed files (auto-generated)
โ”œโ”€โ”€ mappings.json       # Filename mappings
โ””โ”€โ”€ media_converter.sh  # Main script

3. Create Filename Mappings

Create a mappings.json file to map short input filenames to the exact ROM names in your EmulationStation (ES-DE) library:

{
  "sonic-1": "Sonic the Hedgehog",
  "mario-64": "Super Mario 64",
  "zelda-oot": "The Legend of Zelda: Ocarina of Time",
  "ff7": "Final Fantasy VII",
  "twewy": "The World Ends with You Final Remix [0100C1500B82E000][v0]",
  "disc-ely": "Disco Elysium - The Final Cut"
}

Tip

Why use mappings? This lets you organize your input files with simple, memorable names like zelda-oot.png while ensuring the output matches your exact ROM filename. No more typing ultra-long game names for every single media file!

4. Run the Converter

# Normal operation
./convert-media.zsh

# Preview what will be processed
./convert-media.sh --dry-run

# Debug mode for troubleshooting
./convert-media.sh --debug

๐Ÿ“ Supported Media Types

Folder Purpose Output Format Dimensions
screenshots In-game screenshots PNG 1920ร—1080
fanart Background artwork PNG 1920ร—1080
titlescreens Game title screens PNG 1920ร—1080
covers Box art/covers PNG 420ร—680
marquees Clear Logo marquees PNG 600ร—300
physicalmedia Cartridge/disc images PNG 500ร—500
videos Gameplay videos MP4 <10MB target

๐ŸŽฌ Video Processing Logic

Note

The script uses intelligent compression strategies based on file size:

  • Files < 10MB: Attempts lossless compression first
  • Files โ‰ฅ 10MB: High-quality lossy compression targeting 9.5MB
  • Codec Priority: H.265 (preferred) โ†’ H.264 (fallback)
  • Quality Settings: CRF 28 (H.265) / CRF 26 (H.264)

Example Workflow

Input files (easy to type):

input/screenshots/
โ”œโ”€โ”€ sonic-1.png
โ”œโ”€โ”€ mario-64.jpg
โ”œโ”€โ”€ zelda-oot.png
โ””โ”€โ”€ ff7.jpg

Mappings file:

{
  "sonic-1": "Sonic the Hedgehog (USA, Europe)",
  "mario-64": "Super Mario 64 (USA)",
  "zelda-oot": "Legend of Zelda, The - Ocarina of Time (USA) (Rev 1)",
  "ff7": "Final Fantasy VII (USA) (Disc 1)"
}

Output files (match your ROMs exactly):

output/screenshots/
โ”œโ”€โ”€ Sonic the Hedgehog (USA, Europe).png
โ”œโ”€โ”€ Super Mario 64 (USA).png  
โ”œโ”€โ”€ Legend of Zelda, The - Ocarina of Time (USA) (Rev 1).png
โ””โ”€โ”€ Final Fantasy VII (USA) (Disc 1).png

Note

Files without mappings will keep their original filename (minus extension), so the system is completely optional but highly recommended for complex ROM collections.

๐Ÿ“ Usage Examples

Basic Processing

# Process all media in input folders
./media_converter.sh

Preview Mode

# See what files would be processed without making changes
./media_converter.sh --dry-run

Debug Mode

# Show detailed processing information and commands
./media_converter.sh --debug

Help

# Show all available options
./media_converter.sh --help

๐Ÿ› ๏ธ Troubleshooting

Common Issues

"ImageMagick not found"

# macOS
brew install imagemagick

# Ubuntu/Debian  
sudo apt install imagemagick

"Invalid JSON in mappings.json"

  • Validate your JSON syntax using jsonlint.com
  • Ensure proper comma placement and quote matching

Video encoding fails

  • Check if input video is corrupted: ffprobe input_file.mp4
  • Verify FFmpeg installation: ffmpeg -version

Happy Gaming! ๐ŸŽฎ

About

Cleans and converts game metadata, artwork into the correct size and formats expected by Emulation Station Desktop Edition (ES-DE)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages