Change directory to your game's project directory first.
Please note that the original files will be deleted, so if you want the original files to be kept, copy the original files outside of your game's project directory.
You need GNU coreutils, GNU parallel, Perl, ffmpeg, and webp tools installed.
If you are running Windows, these can be installed from within Windows Subsystem for Linux.
Audio format (change any occurrence of ogg to your audio format):
Code: Select all
find . -name \*.ogg -print0 | parallel -0 --nice 19 ffmpeg -y -i {} -c:a libopus -b:a 64k -f webm {}.mka
find . -name \*.ogg.mka -exec rename -f 's/.ogg.mka$/.ogg/' {} +;
Video format (change any occurrence of avi to your video format):
Code: Select all
find . -name \*.avi -execdir ffmpeg -y -i {} -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 4 -speed 4 -tile-columns 6 -frame-parallel 1 -an -passlogfile {} -f webm /dev/null \;
find . -name \*.avi -execdir ffmpeg -i {} -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 4 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -passlogfile {} {}.mkv \;
find . -name \*.log -delete
find . -name \*.avi.mkv -exec rename -f 's/.avi.mkv$/.avi/' {} +;
Lossless image format (change any occurrence of png to your lossless image format):
Code: Select all
find . -name \*.png -print0 | parallel -0 --nice 19 cwebp {} -lossless -o {}.webp \;
find . -name \*.png.webp -exec rename -f 's/.png.webp$/.png/' {} +;
Lossy image format (change any occurrence of jpg to your lossy image format):
Code: Select all
find . -name \*.jpg -print0 | parallel -0 --nice 19 cwebp {} -o {}.jpg \;
find . -name \*.jpg.webp -exec rename -f 's/.jpg.webp$/.jpg/' {} +;