View Full Version : Lower RAM usage in x264 lossless mode
Rumbah
12th February 2011, 14:50
Hi,
I'm encoding my slow avisynth script to x264 lossless for further encoding/filtering.
As I'm running multiple instances and run into memory problems I tried to lower the RAM usage of x264 with the presets but didn't have any luck. I'm encoding 1280x896 @ 15p video and x264 uses about 450 MB RAM. Is there any option to lower this value?
My command line is:
x264.exe --qp 0 --preset fast
Thanks
Rumbah
nm
12th February 2011, 16:56
Most of that memory is going to AviSynth. I tried your x264 settings with a 1920x800 video fed through lavf input and x264 only used 86 MBs of memory.
Add SetMemoryMax(64) or SetMemoryMax(128) to your AviSynth script.
LoRd_MuldeR
12th February 2011, 17:06
Or move Avisynth into it's separate process with the help of AVS2YUV, so both processes (x264 and Avisynth) can have their own 2 GB address space.
Or switch over to 64-Bit x264 + 64-Bit Avisynth, which practically resolves any memory limitation (I assume you use 32-Bit currently). As a bonus, 64-Bit will also be slightly faster...
Rumbah
12th February 2011, 17:25
I'm not running into the 2 GB barrier, the thing is that my script is not multithreaded so i run multipleencoding instances at once.
SetMemoryMax(XXX)
AviSource("BISKDEAD[0].avi")
Assumefps(15)
MergeChroma(BilinearResize(width(), height(), src_left=-0.5))
nnedi3_rpow2(rfactor=4,cshift="spline36resize",qual=2)
MCTemporalDenoise(settings="very high", edgeclean=true, enhance=true, Tovershoot=2)
The thing is that with Setmemorymax(640) the encoding with x264 takes 1100 MB RAM. I cannot lower the Setmemory any further as then the encoding slows down to one fifth. With setmemorymax(850) it runs about 10-20 percent faster but the three processes take so much ram that windows begins to swap (4 GB of RAM in the system).
LoRd_MuldeR
12th February 2011, 17:36
If you are actually limited by the (global) physical RAM, not by the (per process) virtual memory space, you should consider running fewer instances in parallel or upgrading your RAM ;)
(After a phase of increasing RAM prices, DDR3-RAM is very cheap at the moment!)
nm
12th February 2011, 17:45
The thing is that with Setmemorymax(640) the encoding with x264 takes 1100 MB RAM.
x264 really shouldn't use that much memory with your command-line. Try with avs2yuv to see the memory consumption of both AviSynth and x264 separately.
Rumbah
12th February 2011, 18:12
(After a phase of increasing RAM prices, DDR3-RAM is very cheap at the moment!)
I know, but I have to buy DDR2 RAM that's not that cheap and I didn't want to put that much money in it anymore as I will have to buy new one with a new pc ;)
Try with avs2yuv to see the memory consumption of both AviSynth and x264 separately.
I'll try that
EDIT: Ok, it's avisynth using about 350mb more than in SetMemoryMax. x264 is indeed only using 80 mb.
Didée
12th February 2011, 18:25
MCTemporalDenoise(settings="very high", edgeclean=true, enhance=true, Tovershoot=2)
That's where your RAM usage is going into. MCTD needs lots of memory - the higher the settings, the more memory it needs. Not much you could do about that.
Rumbah
12th February 2011, 20:28
Yes, I know, but the result is simply (slow as hell but) amazing ;)
That's why I save it to a lossless format before I tinker with it any further.
Selur
12th February 2011, 21:15
'--rc-lookahead 0' might help
Sharktooth
13th February 2011, 04:11
no it cant since the problem is in avisynth and x264 is only using 80 megabytes.
Selur
13th February 2011, 15:44
hups, misread the post from before,.. read 800MB instead of 80MB. ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.