View Full Version : Avisynth read error


paulom
18th November 2009, 17:05
I am getting this read error in Avisynth while using VirtualDub to encode an avs script.
The avs script is one I had already encoded without problems. The great difference is that I have moved to a new computer, with more ram, a different motherboard and a faster processor.
I had of course to reinstall Windows XP, Avisynth and VirtualDub (the same versions I had before). I made my best to set up the same environment, but maybe I have left something behind...
I have searched for this message with Google, but found no references to it.
Thank you for any possible help with this problem. I really don't know were to run...

Guest
18th November 2009, 17:16
Post your script.

paulom
18th November 2009, 17:38
I don't have it here, but I'll post it ASAP.

Guest
18th November 2009, 17:52
Also, if that occurred during encoding, what was your output codec?

paulom
28th November 2009, 11:37
First of all, please excuse me for not aswering you earlier. I've had a lot of things and people needing my attention these last days.
The problem is still here, but I have some new information about it.

The error in my first post happened while I was using ffdshow-tryouts to make DirectShowSource decode my mpeg-1 videos as YV12. This solution came out from my previous topic http://85.230.118.136/showthread.php?t=150416, but I'm not shure to have encoded a full script with it in my old computer. So I've tried uninstalling ffdshow, and the error messages changed to these below. I've tried to encode 4 more times and got 2 of each message, at different frames.

I also have rebuilt my old machine with a fresh install of Windows XP and all the related software, except ffdshow, and tried to encode the same script. It completed successfully with no error messages, as it used to be.

In all cases, the output codec was Windows Media Video 9 VCM. In my old machine, I've set the "Force keyframes every 1 frame" option to achieve a reasonable encoding time (about 2:30h).
For the last attempt in my new machine I've also used this setting. The estimated encoding time before the crash was about 20min. I've also set VirtualDub Threading option back to 0 for this last attempt, it was set to 1 for the previous ones. All this seems to make no difference.

My old computer has an Athlon XP 2200 processor and 768Mb ram. The new one has an Athlon II X2 240 and 2Gb ram.
Attached are my script and some functions I have coded. The script is simply a slide show of photos and 2 movies, with panning and zooming effects and transitions. The TransFlipPage function is from VC Mohan's TransAll plugin.

I will now try to encode this script in my old computer with ffdshow-tryouts installed.

BTW, I've been trying to connect to forum.doom9.org for the past 2 days without success, getting the message "server is unavailable". Only now I found the forum IP 85.230.118.136 and could connect through it.

poisondeathray
28th November 2009, 17:41
Does your script preview ok in vdub, if you scrub through the timeline (and past frame 22591)?

What happens if you use another compression format (e.g. xvid) ? ie. Could it be a WMV error

Try adding SetMemoryMax(512) to the top of the .avs script, perhaps the processes are not releasing memory properly. Watch task manager and monitor your memory consumption

Try increasing page file size

Check your memory integrity e.g. use memtest 86+ from dos boot, maybe you have a bad stick

While you're at it, monitor your loaded temps (e.g. coretemp, realtemp, everest etc...)

osgZach
28th November 2009, 18:14
I had a problem like this when I was playing around with the SAA() function. Tried 16x for fun and ran out of memory

If you are using anything like that, might want to look into if your setting something too high in one of your filters

paulom
29th November 2009, 05:15
I have installed ffdshow-tryouts in my old machine and again encoded the script without errors.

Aswering some of your questions:
- Yes, the script previews ok in Vdub throughout all frames.
- I've already checked memory integrity, no errors were found.
- I'm not using SAA() function.

I have set page file to "System managed size" (don't know why it was set differently, I haven't changed that since XP installation), and also included SetMemoryMax(512) in the script. The result was again the "GetFrameBuffer: Returned a VFB with a 0 data pointer" error. But this time right at frame 1618! Never had such an early error before, it always happened between frames 16000 and 23000. Maybe this means something?

I have also watched the temperature. In the BIOS setup I have set warning temp to 65º and shutdown temp to 70º, the lowest values. I also have enabled Smart Fan Control and watched the fan: it kept running at minimum speed.

Then I removed SetMemoryMax(512) and tried again. The error "CAVIStreamSynth: System exception - Access Violation" ocurred at frame 16211.

I'll try to encode with Xvid and tell what happened - I'm getting hopeless...

paulom
30th November 2009, 14:14
I've installed Xvid and tried encoding with it, leaving all options as default. Got the error "Subtitle: GDI or Insufficient Memory Error" at frame 17969.

If anyone has any other suggestion, please tell me, I'll try anything to make Avisynth work.
I have a 2 years work built on it, and no alternative to make without it.

For these two years I have used Avisynth in my old machine without a single problem. Now it has more resources, how can this be so catastrophic???

Gavino
30th November 2009, 14:31
Load your script into VirtualDub and run the "video analysis pass" from the File menu. While this is running, watch the memory usage in Task Manager.

If this runs successfully to the end without showing an increase in memory used, the problem is with the encoding and not with Avisynth.

Your error message suggests Avisynth has run out of memory, but this may be because something else (eg the encoder) is using it up.

paulom
30th November 2009, 17:13
I'll do that as soon as I get home.

Gavino
30th November 2009, 20:42
Just having a quick look at the functions you posted, I notice that in your SlideTitle function, you apply Animate to Subtitle (to get a moving title on a sliding stripe). This is both slow and memory-intensive.

This is probably not the sole source of your problems, but a more efficient approach would be to apply the Subtitle once to the stripe and slide the combined stripe+title.

paulom
1st December 2009, 02:32
I've just run the video analysis pass. The error "CAVIStreamSynth: System exception - Access Violation" ocurred around frame 22000.
In Task Manager, the PF usage raised to 1.48Gb when the script was opened, and varied between 1.9 - 2.1Gb during the pass. It was almost a straight line up to the error and after it, until I closed the video file. The peak commit charge reached 2.13Gb, far below the 3.60 limit.

About the SlideTitle function, I know it is not the best way. It's just because I wanted the stripe to be transparent, but not the subtitle. I've tried to define an opacity mask with both, but some ugly antialiasing effects show up.

Anyway, I've made a test disabling SlideTitle, commenting all the function code and simply returning the input clip, and run the video analysis pass again.
Guess which was the result? "CAVIStreamSynth: System exception - Access Violation" error!

paulom
2nd December 2009, 23:23
I've run another test. I thought the errors might be related to dual core, so I've set VirtualDub process affinity to CPU 0 only.
Again, it made no difference. I've run the video analysis pass and got the error "Subtitle: GDI or Insufficient Memory Error".
Then I've run it with the SlideTitle function disabled, and the error was "CAVIStreamSynth: System exception - Access Violation".

Gavino
2nd December 2009, 23:51
Both those errors stem from the same underlying problem - lack of memory. Which one you get will depend on where the error is discovered.

Your script is quite memory intensive, with a large number of ImageSource calls (with large resolution photos?), and a lot of Overlays in your functions. The odd thing is you say it worked on your earlier setup - are all the sources exactly the same as before?

paulom
3rd December 2009, 15:30
Yes, all the sources are exactly the same. All the photos have been resampled to smaller resolutions. Some of them are 640x480, but most are somehow bigger, to allow zooming and panning. Never more than 960x720, usually less.

The script not only worked in my old computer, but still works. I have deleted all the partitions I had in my old HD, created a new one, reinstalled XP and the necessary software - and it is encoded without errors.

Some tests I have been thinking are:
- encode the script directly with MS Expression Encoder 3, without VirtualDub.
- fall back to Avisynth 2.57.
- borrow an additional 1Gb from my son's computer.

But really, sometimes I just would like to sit down and cry!

Gavino
3rd December 2009, 16:51
Don't despair ... :)
There must be some difference between your old and new setups that is causing a difference in memory usage. What about the DirectShow codec being used for your movie - are you sure it is the same on both? It would be worth trying the experiment of replacing DirectShowSource with MPEG2Source.

paulom
4th December 2009, 01:33
I've tried MPEG2Source before, as a way to decode my mpeg-1 videos as YV12. DirectShowSource converts them to YUY2. I have found that MPEG2Source only accepts d2v files as input, so I would have to use DGIndex to make a d2v of each mpeg-1. I've done this once successfully, but didn't use this method because it would be a huge work to make this for all my video files.

Later I found how to install ffdshow-tryouts and make DirectShow use it to decode mpeg-1, so the output of DirectShowSource was YV12. I was using that in my old setup.

I've commented out the lines of the script that called DirectShowSource (only two video files are included), and run the video analysis pass. Got "CAVIStreamSynth: System exception - Access Violation" error again, so it looks like DirectShow is not guilty.

I have not installed Expression because it requires .NET 3.5 SP1, and I think it's better not to introduce this now (though I had it installed in my old setup, and have encoded scripts successfully). But I have tried to encode the script with QuEnc. No error messages were shown, and watching Task Manager it looked like it finished ok. But when I played the video, it simply turned into black frames after a certain point. Looks like Avisynth crashed and QuEnc continued encoding empty frames (frame count is correct).

MatLz
4th December 2009, 04:24
Hi!
Maybe it's again my habitual useless reply...but have you warpsharp.dll in your plugins directory?

paulom
4th December 2009, 12:54
Maybe it's again my habitual useless reply...but have you warpsharp.dll in your plugins directory?
No, I don't...

But you just gave me an idea! I'm using only 2 external plugins: TransFlipTurn and HDRAGC. I'm going to replace them by dummy functions and see what happens.

paulom
5th December 2009, 22:54
I've coded a dummy TransFlipPage and commented the HDRAGC call (only one line). For the first time the video analysis pass ran without errors.

But remember I had already commented DirectShowSource calls and all the code inside my SlideTitle function. If I uncomment any of them (HDRAGC, DirectShowSource or SlideTitle) the same error is back: "CAVIStreamSynth: System exception - Access Violation".

paulom
6th December 2009, 11:40
I have added 1Gb of ram to my computer, now it has 3Gb.
I supposed that, if the errors were caused by lack of memory, the situation should have got better. But no, it got worse!

Now I get the error "GetFrameBuffer: Returned a VFB with a 0 data pointer!" in any of the cases I mentioned in my last post.
Even in the first one, where with 2Gb the video analysis pass had run without errors.

HELP, PLEASE!

paulom
6th December 2009, 15:11
I've just run the video analysis pass of VirtualDub in my old computer, to watch the memory usage.

All the functions were enabled - no dummies, no comments.
It took more than 2 hours. CPU usage was always 100%. Peak commit charge was 1903Mb, the limit is 2074Mb. The physical memory is 735Mb.

And there were absolutely no errors!

kemuri-_9
6th December 2009, 16:21
avisynth by default sets its maximum frame cache to be 25% of the computer's RAM.

increasing the total ram will implicitly increase this cache size,
which will also implicitly decrease the amount of ram that can be used by memory intensive scripts and filters due to the reason below.

you can only have 2GB of allocated memory to a 32bit program (which includes avisynth at this time) before you get memory allocation errors like the ones you've been facing,
and your script is highly memory intensive so i very much suspect you're hitting this limit regularly.

you can work around this by splitting the script over more processes,

i.e. do half of it in one script and use TCPDeliver to transfer it to another script to do the other half.
where both processes would have their own 2GB limits.

Gavino
6th December 2009, 16:50
Well done, kemuri-_9, I think you have found the answer to the paradox that paulom's script performed worse with more memory.

But I believe a simpler solution is just to use SetMemoryMax() to limit the amount of cache memory used, allowing more to be available to the filters, etc.

kemuri-_9
6th December 2009, 17:16
But I believe a simpler solution is just to use SetMemoryMax() to limit the amount of cache memory used, allowing more to be available to the filters, etc.

yes, SetMemoryMax may work, but it may also not help.
it really depends on how memory intensive the filtering is...
i.e. if it still hits the memory limit with a lowered SetMemoryMax value.

it would be a good thing to try though.

paulom
7th December 2009, 01:50
I have already tried adding SetMemoryMax(512) to the script, following poisondeathray's advice (post #8).
The result was the error "GetFrameBuffer: Returned a VFB with a 0 data pointer" right at frame 1618.

Today I have run the same tests of my post #21 on another computer, with an Athlon 64 X2 5000+ processor and 2Gb ram. The results were exactly the same, in accordance with kemuri-_9's explanation.

I'll make some tests following your directions and post the results.

Gavino
7th December 2009, 01:59
Try with SetMemoryMax(192), which should give you roughly the same as your setup in post #23, which worked.

paulom
8th December 2009, 11:45
I've tried with SetMemoryMax(192), all functions enabled, and video analysis pass completed without errors.

Now I will reinstall ffdshow-tryouts and try to encode my script.

paulom
9th December 2009, 01:10
I've reinstalled ffdshow-tryouts and used Xvid to encode my script, without errors. :)

Thank you, Gavino and kemuri-_9, for the precious help.