Custom RetroPie Scriptmodules

This is a collection of custom script modules I wrote for use with RetroPie.
These are considered experimental at best, so use at your own risk.


Script List

How to Install

Connect to RetroPie via SSH and run these commands in order:

cd ~/RetroPie-Setup/
git clone https://gitlab.com/SuperFromND/retropie-custom-scripts.git
sudo cp -R retropie-custom-scripts/scriptmodules/* ~/RetroPie-Setup/scriptmodules
rm -rf ~/RetroPie-Setup/retropie-custom-scripts

Alternatively, click the floppy disk to download a .zip of the scripts to install manually:





MP4 to GIF Batch Script for FFMPEG

Below is a batch script that can convert an MP4 file into a GIF with minimal hassle.
The main benefit over EZGif is that this allows for 50fps gifs with no length limit.
Save it to a file, then place it into the same directory as ffmpeg.exe.


@echo off
set /P id=Drag your MP4 into this window and press Enter.
set /P size=What scale do you want this at?
ffmpeg -v warning -i %id% -vf "fps=50,scale=%size%,palettegen" -y palette.png
ffmpeg -v warning -i %id% -i palette.png -lavfi "fps=50,scale=%size%:-1:flags=lanczos [x]; [x][1:v] paletteuse" -y output/output.gif
start output

Windows Command-line Batch Processing

Windows's command line can process all files in your current directory at once.
The syntax is:


for %f in (*.extension) do command

Here's an example that uses ImageMagick to replace a specific color (formatted in RGB) with transparent. Very useful for things like ripping old game animations.


for %f in (*.png) do magick convert %f -transparent "rgb(19,19,19)" %f

Another example, this one uses FFMPEG and can convert folders worth of WAV files to OGG Vorbis. Handy, but be careful when using it!

@ECHO OFF

for /d %%d in (./*) do (
    echo Navigating to %%d
    cd %%d
    for %%f in (*.wav) do (ffmpeg -i "%%f" "%%~nf.ogg")
    cd ..
)

echo Done!

Music Video Command for FFMPEG

This command here can take an audio file and a PNG file, and using those, create a video file out of them similar to what you might find on YouTube channels that upload music.


ffmpeg -loop 1 -i image.png -i audio.ogg -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4