README How to compress video collections

rf96

I rape lolis with my tentacles
Uploader
Donor
Aug 11, 2017
9,921
73,254
Some animation collections can be huge, sometimes well above 50Gb. If you don't need 8K 60FPS 50K bitrate videos to fap, you can compress your collections by following these instructions.

1. First of all, remove all the developer's files, such as .blend, or video timelapses, etc. Artists often add work in progress files and you may want to remove these as well. You only want to keep the animations [unless the artist also makes pictures!, in which case compress these files following the tutorial for compressing pictures].
Use the search function (ctrl+F) and type the extensions of the files you want to remove (eg. ".blend"). The collection could be much lighter after this.


2. For the compression use the freeware , a visual interface for FFmpeg:


3. You need to configure the preset:
a. go to "edit", then "presets".
1.png

b. Select "MPEG-4" in the first list, then "MPEG-4 720p" in the second list.

c. Paste this code in the Preset command line parameters:
Code:
-crf 20.0 -vcodec libx264 -filter:v scale=-2:720 -preset slow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0
d. First click on "add / update", then "save".
2.png

e. In the "Output details" tab, select the preset "MPEG-4" and "MPEG-4 720p".
In "Output folder", select "Use source folder" (note: you can select another folder, but then you will lose the original folder structure. If you select another folder, you can disregard the part about the underscores).

3.png


3. Then you need to prepare the files. If all the video files are in one folder with no subfolder, skip to 4. Otherwise, if the videos are spread over many subfolders, you need to do this:
- Use the search function (ctrl+F), and type a dot: ".", it will list all the files in the folder, including subfolders. If there are many pictures, you can search by extension, eg. ".mp4", and it will only list video files (note: some artists use unusual video formats, such as .avi, .wmv, .flv, etc., you may need to search for them too).
- Select all the video files you want to compress. You can sort by extension.
- *In case you have underscores in the file names*: you need to remove them. On Linux it's easy, but not on Windows. The easiest way I have found is to use a command line: hold shift and right click in your main folder, "open powershell window here", then paste:
Code:
get-childitem *.mp4 -Recurse | foreach {rename-item $_ $_.name.replace("_"," ")}
It will replace your underscores with spaces.

Once you have selected all the files you want to convert, skip to 4.


4. Drag and drop all the selected files to WinFF. Important: do not navigate away from your window with the original files, nor deselect them!

Then select "Convert". It will open another window summarising the tasks. Click "run".
Another window will open. A line in blue will appear once the conversion is done. It can be long.


5. Once the conversion is done, return to your window with the original files. Press "delete".

Run the Powershell once more and paste this code (this is because WinFF adds a o_ prefix to all the new files that shares the same name with the original ones):
Code:
get-childitem *.mp4 -Recurse | foreach {rename-item $_ $_.name.replace("o_","")}
Tadam, your big original files should have been replaced by the compressed files by now, with the original folder structure preserved.


The current preset should save about 80% space for files in 1080p with a 10K bitrate, and up to 99% for some monster 4K files!

Feel free to experiment with the FFmpeg code.
 
Last edited:

Call2Ur

Member
Dec 29, 2021
233
776
Hey, rf96

So I tried using WinFF with this preset to compress some videos. However, I found that the ones with vertical formats end up being stretched. Is there a way to fix this?
 

rf96

I rape lolis with my tentacles
Uploader
Donor
Aug 11, 2017
9,921
73,254
Hey, rf96

So I tried using WinFF with this preset to compress some videos. However, I found that the ones with vertical formats end up being stretched. Is there a way to fix this?
you need to use the exact preset i wrote above
 

Larry669

Newbie
Dec 28, 2022
18
0
i tried converting a video, but couldn't play it because it's file size is 0kb? What did I do wrong?
 

Call2Ur

Member
Dec 29, 2021
233
776
i tried converting a video, but couldn't play it because it's file size is 0kb? What did I do wrong?
Had the same problem as well. I found that by entering "-strict -2" after the code in the command line fixes it.
Here's the full code I used in the Preset Command Line Parameters:

-crf 20.0 -vcodec libx264 -filter:v scale=-2:720 -preset slow -acodec aac -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 -strict -2
Try it and see if it works.
 

Larry669

Newbie
Dec 28, 2022
18
0
Had the same problem as well. I found that by entering "-strict -2" after the code in the command line fixes it.
Here's the full code I used in the Preset Command Line Parameters:



Try it and see if it works.
could you give me the code for conversion to 1080p?
 

rf96

I rape lolis with my tentacles
Uploader
Donor
Aug 11, 2017
9,921
73,254
what about default preset for 720 or 1080 convert of WinFF? Is it ok or i should use your code to custom it?
the original code has at least one error when converting vertical vid, i don't remember if i fixed something else
 
  • Like
Reactions: Remizdabezt

xingyueliuli

New Member
Feb 4, 2022
2
1
thank rf96. I use shanaencoder for x265 compression almost every time. it is also a GUI for FFmpeg. just to get as high quality video as possible and not too big 屏幕截图 2023-05-19 122107.png
 
  • Like
Reactions: rf96

melodyyu

New Member
Jun 15, 2023
6
0
I followed your steps, but it still can't be compressed into a small capacity, or the game is deleted directly.
 

Calendar

Newbie
Jun 18, 2020
16
18
If your target devices are relatively modern I would suggest to use av1 instead. Download ffmpeg, set path variable to the exe. Then open cmd in your target folder, use following code
Code:
FOR /r %i in (*.mp4) DO ffmpeg -i "%~fi" -c:v libsvtav1 -crf 30 -preset 6 -svtav1-params tune=0:keyint=10s -pix_fmt yuv420p10le -c:a copy "%~dpni_av1.mkv"
Change the mp4 to whatever your videos format are.
Crf 30 is said to be a good starting point for 1080p but I myself prefer 35, you also can increase it to 40-45 if you want smaller file size.
Preset 6 is the most recommended but if you want faster encode try preset 8 (for reference 8 is better than x265 medium).
Keyint, you can decrease it to 5s or even 2s if you want better seeking performance.
 

johntrine

Member
Oct 14, 2016
340
287
so... i tried this out and for some videos, it worked great. for some videos, it increased the size. now... i accept i am retarded.... any help?
 
Last edited:

LacroixWM

Member
May 21, 2020
114
172
I've been using this masterpiece for a while (thank you so much rf96!) and today I had a strange error. Apparently the frames are too large for it to convert. Is there any way to fix this?
1694684522521.png