Log in

View Full Version : Access violation error


ilovejedd
3rd October 2006, 20:29
Sorry if this is in the wrong forum. I was debating if I should post this on HDTV / DVB / TiVo, DVD2AVI / DGIndex or here, but I finally settled on posting here.

I'm trying to convert some 1920x1080i HDTV caps to AVI (xvid/mp3) and PSP (h264/aac) formats using ffmpeg. I downloaded the ffmpeg build I used from here (http://arrozcru.no-ip.org/ffmpeg_builds/) (SVN-r6179-static-gpl).

Avisynth input script:
video1 = MPEG2source("Ch5-1_ThuSep282006_075902PM p01.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio1 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p01 T01 3_2ch 384Kbps DELAY 101ms.ac3",2).DelayAudio(0.101).Amplify(5)

video2 = MPEG2source("Ch5-1_ThuSep282006_075902PM p02.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio2 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p02 T01 3_2ch 384Kbps DELAY 79ms.ac3",2).DelayAudio(0.079).Amplify(5)

video3 = MPEG2source("Ch5-1_ThuSep282006_075902PM p03.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio3 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p03 T01 3_2ch 384Kbps DELAY 88ms.ac3",2).DelayAudio(0.088).Amplify(5)

video4 = MPEG2source("Ch5-1_ThuSep282006_075902PM p04.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio4 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p04 T01 3_2ch 384Kbps DELAY 100ms.ac3",2).DelayAudio(0.100).Amplify(5)

video5 = MPEG2source("Ch5-1_ThuSep282006_075902PM p05.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio5 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p05 T01 3_2ch 384Kbps DELAY 96ms.ac3",2).DelayAudio(0.096).Amplify(5)

video6 = MPEG2source("Ch5-1_ThuSep282006_075902PM p06.demuxed.d2v").fielddeinterlace().BilinearResize(624,352)
audio6 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p06 T01 3_2ch 384Kbps DELAY 79ms.ac3",2).DelayAudio(0.079).Amplify(5)

AudioDub(video1,audio1) ++ AudioDub(video2,audio2) ++ AudioDub(video3,audio3) ++ AudioDub(video4,audio4) ++ AudioDub(video5,audio5) ++ AudioDub(video6,audio6)
ffmpeg command-line:
ffmpeg -y -i "input.avs" -vcodec xvid -g 300 -bf 2 -r 29.97 -b 1000 -passlogfile "2pass" -pass 1 -an -f avi "output.avi"
ffmpeg -y -i "input.avs" -vcodec xvid -g 300 -bf 2 -r 29.97 -b 1000 -passlogfile "2pass" -pass 2 -acodec mp3 -ac 2 -ab 128 -f avi "output.avi"
About half-way through the AVI encode, I get the following error.
Avisynth read error:
Avisynth: caught an access violation at 0x01b786a5,
attempting to write to 0x00000000
System details:
OS Name: Microsoft Windows 2000 Professional
Version: 5.0.2195 Service Pack 4 Build 2195
System Manufacturer: INTELR
System Model: AWRDACPI
System Type: X86-based PC
Processor: x86 Family 15 Model 3 Stepping 4 GenuineIntel ~3391 Mhz
Processor: x86 Family 15 Model 3 Stepping 4 GenuineIntel ~3391 Mhz
BIOS Version: Phoenix - AwardBIOS v6.00PG
Total Physical Memory: 2,096,620 KB
Available Physical Memory: 1,342,016 KB
Total Virtual Memory: 6,131,612 KB
Available Virtual Memory: 4,882,968 KB
Page File Space: 4,034,992 KB
Page File: C:\pagefile.sys
What's the cause of the error? Insights, thoughts, help? Anyone?

Pookie
3rd October 2006, 21:09
Thank you for providing so much information about your configuration and posting your scripts. I wish there was a Smilie for a gold star.


a) If the problem is occuring halfway through the transcode, could one of the Mpeg2 files be corrupt ? Place the two that are currently in the middle of your script to the top and see if the error occurs earlier in your processing.

b) Simplify your script by commenting out the NicAudio lines. If there is any corruption in your AC3s, you'll see a problem like the one you described. If your transcoding works without the audio, run your AC3s through an app like AC3fix or AC3cutter, then do the audio conversion and muxing with external apps. I'm guessing, but I'll bet one of your AC3s is bad.

foxyshadis
4th October 2006, 01:23
Does it work if you simplify the script like:


video1 = MPEG2source("Ch5-1_ThuSep282006_075902PM p01.demuxed.d2v")
audio1 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p01 T01 3_2ch 384Kbps DELAY 101ms.ac3",2).DelayAudio(0.101)

video2 = MPEG2source("Ch5-1_ThuSep282006_075902PM p02.demuxed.d2v")
audio2 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p02 T01 3_2ch 384Kbps DELAY 79ms.ac3",2).DelayAudio(0.079)

video3 = MPEG2source("Ch5-1_ThuSep282006_075902PM p03.demuxed.d2v")
audio3 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p03 T01 3_2ch 384Kbps DELAY 88ms.ac3",2).DelayAudio(0.088)

video4 = MPEG2source("Ch5-1_ThuSep282006_075902PM p04.demuxed.d2v")
audio4 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p04 T01 3_2ch 384Kbps DELAY 100ms.ac3",2).DelayAudio(0.100)

video5 = MPEG2source("Ch5-1_ThuSep282006_075902PM p05.demuxed.d2v")
audio5 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p05 T01 3_2ch 384Kbps DELAY 96ms.ac3",2).DelayAudio(0.096)

video6 = MPEG2source("Ch5-1_ThuSep282006_075902PM p06.demuxed.d2v")
audio6 = NicAC3Source("Ch5-1_ThuSep282006_075902PM p06 T01 3_2ch 384Kbps DELAY 79ms.ac3",2).DelayAudio(0.079)

AudioDub(video1,audio1) ++ AudioDub(video2,audio2) ++ AudioDub(video3,audio3) ++ AudioDub(video4,audio4) ++ AudioDub(video5,audio5) ++ AudioDub(video6,audio6)

fielddeinterlace().BilinearResize(624,352).Amplify(5)

If so, it's probably a weirdness of fielddeinterlace or amplify stepping on itself.

IanB
4th October 2006, 08:23
Avisynth: caught an access violation at 0x01b786a5,There are many tools that will tell you which .DLL is mapped to this address. Avisynth.dll is usually at 0x010xxxxx and pluggins are usually just above this. FFmpeg unfortuantly (debugging ease wise) loads heaps of support .DLL's so guessing the cuprit becomes near imposible. :(
attempting to write to 0x00000000I would put most of my money on "You have run out of memory". Malloc return 0 when it fails and there is much code that does not check this return state, so a write to 0x0000000 is a strong hint. Check the amount of memory used by the crashing ffmpeg process in Task Manager (before you close the crash dialog) it will be quite large (> 1GB) if this is the case.

If this is the case then a divide a conquore approach may help isolate the problem. i.e. slice up the script until the behaviour changes.

foxyshadis' rationalisation of the script should allow it to proceed a lot further if the memory leakage is within any avisynth routines. If it still crashes in roughly the same place then it is more likely the fault is in some other software.

ilovejedd
4th October 2006, 17:30
Does it work if you simplify the script

If so, it's probably a weirdness of fielddeinterlace or amplify stepping on itself.

Yep. Thanks so much. Still don't know if it was ffmpeg, fielddeinterlace (decomb.dll) or amplify which caused it, but at least mpeg2source (dgdecode.dll) was eliminated from the list. :p

There are many tools that will tell you which .DLL is mapped to this address. Avisynth.dll is usually at 0x010xxxxx and pluggins are usually just above this. FFmpeg unfortuantly (debugging ease wise) loads heaps of support .DLL's so guessing the cuprit becomes near imposible. :(
I would put most of my money on "You have run out of memory". Malloc return 0 when it fails and there is much code that does not check this return state, so a write to 0x0000000 is a strong hint. Check the amount of memory used by the crashing ffmpeg process in Task Manager (before you close the crash dialog) it will be quite large (> 1GB) if this is the case.

If this is the case then a divide and conquer approach may help isolate the problem. i.e. slice up the script until the behaviour changes.

foxyshadis' rationalisation of the script should allow it to proceed a lot further if the memory leakage is within any avisynth routines. If it still crashes in roughly the same place then it is more likely the fault is in some other software.

I already figured it was an out of memory error since I have individual scripts containing just one clip (4-15 mins each) and they converted just fine. I tried to convert the joined clips first using an AMD Sempron 3200+1.8GHz machine with 1GB DDR SDRAM running WinXP Home. After the crash, I thought I might have better luck with a PC with more RAM, hence the 2nd machine (P4 3.4GHz HTT, 2GB DDR SDRAM, Win2k Pro). Sadly, this second machine just died on me... HDD failure. :(

IanB
5th October 2006, 05:39
More physical memory is not going to help. Windows implements virtual memory so as long as you have room for a bigger swapfile that is not an issue (performance however will be).

The whole Win32 address space is 4Gb and the OS reserves the top half (or quarter). Also the way memory is allocated to various purposes means the heap probably has about 1.5Gb available, and each allocation must be contiguous so fragmentation can be contributory.

Memory leaks are insideous. Consider some code that malloc a big block and a small block, it remembers to free the big block but not the small block. So after some time the heap becomes swiss cheese, yes it is 90% empty but the 10% usage is spread over the whole heap and a malloc for a chunk slightly bigger than any of the remaining holes will fail.

foxyshadis
5th October 2006, 06:47
Although the /3GB boot.ini switch, and 64-bit windows, let you ignore the problem that much longer.

ilovejedd
5th October 2006, 06:48
More physical memory is not going to help. Windows implements virtual memory so as long as you have room for a bigger swapfile that is not an issue (performance however will be).

True, but in my first trial, ffmpeg crashes as soon as it gets an out of memory error, even while Windows is allocating more room for virtual memory. I just thought maybe if I had a bigger page file off the bat (I think by default, virtual memory is 1.5x physical memory), then I might not need to mess with the way Windows handles virtual memory. I had been expecting to mess with the default VM settings. I try not to mess with advanced settings as much as possible. More often than not, know-it-all computer tweakers who have no understanding of what they're tweaking end up with unusable PCs or ones which constantly require a reformat.

foxyshadis' suggestion is much better, though. I was monitoring the CPU and memory usage of ffmpeg during the first run (AMD Sempron 1.8GHz, 1GB DDR SDRAM). Almost directly prior to crashing, ffmpeg memory usage was 700MB and total page file usage was around 1500MB (I guess 700MB x 2 because of swap, plus the rest for the myriad of processes WinXP requires to operate). With foxishadis' revised script, I think ffmpeg memory usage was just around 150MB throughout. Quite an amazing difference.

As for the rest, I'll just pretend I understand what you're saying. Nice analogy with the Swiss cheese, though. Even a layman like me could understand. LoL, note to programmers, remember to close all open handles when you're done using them. :p