Created
February 13, 2018 00:50
-
-
Save pablosbrain/075a13df34e4b8e54e68e625a05becf7 to your computer and use it in GitHub Desktop.
Automate conversion of .mp4 rom snaps to .jpg screenshots.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /D %%i in (./roms_snaps/*) DO ( | |
echo %%i | |
if not exist "roms_snapschreenshots\%%i\screenshot" ( | |
echo No %%i/screenshot Folder | |
mkdir roms_snapschreenshots\%%i\screenshot | |
) | |
for %%r in (./roms_snaps/%%i/snap/*.mp4) DO ( | |
if not exist "roms_snapschreenshots/%%i/screenshot/%%~nr.jpg" ( | |
echo No screenshot... Grabbing one... | |
ffmpeg -i "roms_snaps/%%i/snap/%%r" -ss 00:00:01.500 -vframes 1 -vf "scale=min(iw*400/ih\,400):min(400\,ih*400/iw),pad=400:400:(400-iw)/2:(400-ih)/2" -t 1 -f image2 "roms_snapschreenshots/%%i/screenshot/%%~nr.jpg" -hide_banner | |
rem -vf "scale=min(iw*TARGET_HEIGHT/ih\,TARGET_WIDTH):min(TARGET_HEIGHT\,ih*TARGET_WIDTH/iw), | |
rem pad=TARGET_WIDTH:TARGET_HEIGHT:(TARGET_WIDTH-iw)/2:(TARGET_HEIGHT-ih)/2" | |
) | |
) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had a need to create a bunch of image screenshots for the roms in my collection. Here is a small windows bat file that will go through a roms folder and for each of the snap .mp4 files, create a screenshot .jpg file. Make sure you drop a copy of the ffmpeg.exe file (https://www.ffmpeg.org/download.html#build-windows) into the same folder as the .bat file. I used a latest static build.