How to reduce animations size?

Adabelitoo

Well-Known Member
Jun 24, 2018
1,947
3,029
My game has +6500 images (webp) and +125 animations (webm) and the animations are already more than half the size of the game. I'm working in new animations, those +125 animations were 30fps but from now on I wanted to do 60fps which means even more size.

What can I do to save space? I use ShanaEnconder to convert .png (1920x1080) files into a .webm (1280x720) file. I plan to do some changes (mostly GUI things) and change my game resolution to 1920x1080 so using smaller .png would only be a temporary solution. It's worth saying that I'd like to reduce the size but without reducing the quality to total shit.

I'd appreciate any advice.
 
Last edited:

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,673
15,528
My game has +6500 images (webp) and +125 animations (webm) and the animations are already more than half the size of the game. I'm working in new animations, those +125 animations were 30fps but from now on I wanted to do 60fps which means even more size.

What can I do to save space? I use ShanaEnconder to convert .png (1920x1080) files into a .webm (1280x720) file. I plan to do some changes (mostly GUI things) and change my game resolution to 1920x1080 so using smaller .png would only be a temporary solution. It's worth saying that I'd like to reduce the size but without reducing the quality to total shit.

I'd appreciate any advice.
Use a video editor of your choice, to reencode videos in a lower quality or one of the compression tools such as YAC. You can probably adjust quality settings in ShanaEnconder and see what works best too.
 
  • Like
Reactions: Adabelitoo

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,585
2,229
There is also Cruncher.

Whilst most people use it to massively reduced a game in size to create a "compressed" version, it is using standard tools to convert images/videos/sounds from one format to another. The scripts are configured to leave the resulting files as very small.

With a little editing of the script, you could alter the parameters to be not quite so rabid in it's attempts to make small files. Instead of reducing the overall size of the project by 70-85%, you could tweak things to aim for 40% or similar.

For example, the script has a line:

set "command-var2="%CD%\Cruncher-x64\ffmpeg.exe" -i "%%a" -c:v libvpx-vp9 -threads 8 -row-mt 1 -quality good -pass 2 -b:v 0 -crf 40 -speed 1 -tile-columns 4 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 240 -vsync 2 -r 30 -c:a libopus -vbr on -compression_level 10 -frame_duration 60 -application audio -b:a 32k -f webm "%%~dpa%%~na".temp."

Okay... that's a lot to parse... but at the heart of it, it's using ffmpeg.exe to recode input video files (%%a) to webm movie files using the vp9 codec. The explains the various command line options. I suspect altering the compress_level will alter the overall size the most.
 
  • Like
Reactions: Adabelitoo

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,673
15,528
There is also Cruncher.

Whilst most people use it to massively reduced a game in size to create a "compressed" version, it is using standard tools to convert images/videos/sounds from one format to another. The scripts are configured to leave the resulting files as very small.

With a little editing of the script, you could alter the parameters to be not quite so rabid in it's attempts to make small files. Instead of reducing the overall size of the project by 70-85%, you could tweak things to aim for 40% or similar.

For example, the script has a line:

set "command-var2="%CD%\Cruncher-x64\ffmpeg.exe" -i "%%a" -c:v libvpx-vp9 -threads 8 -row-mt 1 -quality good -pass 2 -b:v 0 -crf 40 -speed 1 -tile-columns 4 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 240 -vsync 2 -r 30 -c:a libopus -vbr on -compression_level 10 -frame_duration 60 -application audio -b:a 32k -f webm "%%~dpa%%~na".temp."

Okay... that's a lot to parse... but at the heart of it, it's using ffmpeg.exe to recode input video files (%%a) to webm movie files using the vp9 codec. The explains the various command line options. I suspect altering the compress_level will alter the overall size the most.
I find YAC easier for beginners since it has 4 quality presets and you can also indicate a custom quality %.
 
  • Like
Reactions: 79flavors

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,497
7,090
Okay... that's a lot to parse... but at the heart of it, it's using ffmpeg.exe to recode input video files (%%a) to webm movie files using the vp9 codec. The explains the various command line options. I suspect altering the compress_level will alter the overall size the most.
Personally, I find that using ffmpeg's bit rate feature rather than the compression level makes it easier to wrap my head around what ffmpeg is doing.
Code:
-b:v 2M
sets the target bit rate to 2 megabits per second, for example. There's a relatively linear relationship between bitrate and size, so it's easy (for me at least) to tune based on that. Compression levels seem to be slightly less intuitive, at least to me. I've been using 2M for the 1280x720 videos in Family, Friends and Strangers, and 6M for the 1920x1080 videos in Whores of Thrones fairly effectively.

Note that ffmpeg will also do the "image sequence to video" encoding without any problem - in my setup, I do both at the same time.

But I'm sure you can find similar settings in ShanaEncoder - it's just a matter of experimentation and tuning.

I use JPG's instead of WEBP's in the games, but I run them all through ImageMagick, using "-quality 85%", which gives me about a 6:1 reduction in the size compared to what Daz Studio outputs, with every little noticeable difference. I have nothing against WEBP's - it's just "how I've always done it."
 
  • Like
Reactions: Adabelitoo

cold_arctus

Devoted Member
Sep 25, 2018
8,945
10,824
My game has +6500 images (webp) and +125 animations (webm) and the animations are already more than half the size of the game. I'm working in new animations, those +125 animations were 30fps but from now on I wanted to do 60fps which means even more size.

What can I do to save space? I use ShanaEnconder to convert .png (1920x1080) files into a .webm (1280x720) file. I plan to do some changes (mostly GUI things) and change my game resolution to 1920x1080 so using smaller .png would only be a temporary solution. It's worth saying that I'd like to reduce the size but without reducing the quality to total shit.

I'd appreciate any advice.
The other day I used ffmpeg to crunch a file with this settings:

Code:
ffmpeg -i input.webm -c:v libvpx -crf 10 -b:v 3M -c:a libvorbis output.webm
Note: In my case I had to use VP8 but you should go with VP9. The smaller "-crf" value the better the quality; for "-b:v 3M" it's the opposite.

For images I use XnConvert (free tool) to convert jpeg/png to webp at 91 quality settings.
 
  • Like
Reactions: Adabelitoo