Log in

View Full Version : Can I write this more efficiently?


leoenc
28th May 2013, 20:03
Hi

Trying to decode a big ProRes source with 10 mono audio tracks, I'm hitting the 2 GB RAM limit by Avisynth. The script is freezing vdub or ffmbc when the RAM fills to about 1.8 GB.

Can I write the following script more RAM friendly?

v = FFVideoSource("source.mov",cachefile = "source.mov.ffindex")

a1 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=1)
a2 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=2)
a3 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=3)
a4 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=4)
a5 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=5)
a6 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=6)
a7 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=7)
a8 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=8)
a9 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=9)
a10 = FFAudioSource("source.mov", cachefile = "source.mov.ffindex", track=10)

ch1 = GetChannel(a1, 1)
ch2 = GetChannel(a2, 1)
ch3 = GetChannel(a3, 1)
ch4 = GetChannel(a4, 1)
ch5 = GetChannel(a5, 1)
ch6 = GetChannel(a6, 1)
ch7 = GetChannel(a7, 1)
ch8 = GetChannel(a8, 1)
ch9 = GetChannel(a9, 1)
ch10 = GetChannel(a10, 1)

a = MergeChannels(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10)

AudioDub(v, a)

StainlessS
28th May 2013, 20:40
If it's just a one-off, have you tried extracting them individually to WAV, then using WAV's as input ?

SamKook
28th May 2013, 21:08
Have you tried patching vdub to enable the LAA flag(there are tools for that)? If you have a 64bit OS, you should be able to use up to 4GB after it's done for 32bit process.

It helps prevent crashes for me when I use memory heavy scripts with vdub.

leoenc
29th May 2013, 12:18
Thanks but it's for encoding in ffmbc (I use vdub just to test the script), and it's not a one-off so extracting first to WAVs isn't an option.

Using QTinput instead uses only a fraction of the memory but unfortunately it has other problems.

SamKook
29th May 2013, 14:32
It might also help with ffmbc(although I'm not familiar with it) if it doesn't have it set by default. That's a flag that can be set on any 32bit exe, but most people don't when compiling because it's not the default option since I think it could potentially cause problems for people with little RAM(it's been a while since I read the reason so I'm not sure).
With todays 64 bit system though, there's no problem with enabling it.

leoenc
29th May 2013, 15:10
@SamKook

It worked!

I patched ffmbc and that did the trick. For anyone interested - simply Google for 4GB patch.

Thanks a lot!