PDA

View Full Version : Why does AVISynth freeze at the end of a video? (I think AVISource is the culprit)


Nazo
14th March 2006, 07:28
I have been trying to encode the same video files quite a number of times in the past. The thing that keeps getting me is I need to run the encodes overnight but, AVISynth makes it freeze somehow at the end of each encode. It's definitely avisynth because I don't have this issue with other things such as an ordinary AVI file in the encoder and when I tried the AVS script in my media player, it somehow freezes when I try to close it a lot of the time. (Wouldn't be quite so bad if it didn't end up taking 100% cpu power for as long as I leave it until I kill the process -- well, ok, I probably haven't left it any longer than 8 hours or so so far, but, obviously that won't do anyway.) At this rate, I suppose I may finally finish encoding all thirteen of them in a few weeks, but, twice now I've been quite upset because I wanted them done by the next day and spend hours upon hours trying to figure out what's going on and fix it to no avail (so the fact that I'm loosing out on the amount of sleep I really need to be getting for no gain makes me even less happy...) Unfortunately, I wanted to try DirectShowSource to verify, but, it doesn't work (as discussed in a seperate threat) so I can't be 100% sure that it is AVISource.

Any idea what I'm missing here? The videos themselves play fine and probably encode fine (unfortunately, it has soft-subs, and I need to encode them as hardsubs in a MPEG2 video, which is why I needed to use AVISynth, so I can't bypass AVISynth. I think VirtualDub[Mod] would work except that since I'm making MPEG2 non-avi files for DVDs I'd have to frameserve each one by hand to TMPGEnc, which kind of defeats the purpose of trying to do a batch encode.

At this rate, I'll be done doing them manually one by one by the time I fix this problem and I'm already screwed for time where there's no way physically possible to get this done unless someone actually replies with a solution that works right off for me in the next five minutes, but, whatever is causing this isn't something I can afford to ignore. Whatever it is, I NEED to fix it.

communist
14th March 2006, 12:47
Since your destination is DVD why not keep it softsubbed?

Have you made sure it isnt a hardware problem (overheating / overclocking etc.)? See http://forum.doom9.org/showthread.php?t=54130

Also are you using any special plugins for AviSynth that might crash it? Post your script.

And last but not least can you post a (short) sample to reproduce that error? Does it only happen in TMPG batch mode or also other encoders (HC/QuEnc or just for testing VirtualDub)?

Nazo
14th March 2006, 13:05
Since your destination is DVD why not keep it softsubbed?
Ugh, DVD subs are practically hardsubs. Converting into their format is even tougher than encoding and the only thing "soft" about it is that you have the ability to turn them off or choose different ones (to me at least, the real point of softsubs is the ability to control the fonts and such to get them at maximum readability and minimum intrusiveness -- and, the coolest thing is that my windows video player even lets me move subs to the bottom of the screen so that on a 16:9 video I have softsubs outside of the video and not in the way -- to me that is the REAL advantage of softsubs, not the ability to turn them off or something.) Since I just want the one set and I want them on by default anyway and I have to reencode the files no matter what (no, my portable does not support MPEG4 unfortunately,) I'd rather deal with AVISynth than a troublesome conversion.

Have you made sure it isnt a hardware problem (overheating / overclocking etc.)? See http://forum.doom9.org/showthread.php?t=54130
QUITE sure. I only accept an overclock that is 100% Prime95 stable. Unfortunately, heat can not become an issue so long as my AC functions (and possibly even if it breaks.) I say unfortunately, because it's the hotter processors that overclock more and mine is one of the coolest, running below 30C while idle and probably having never risen above 40C since I first put it in. The hotter San Diegos go higher with some having reached as much as 3.2GHz on water, but, if I had one of the good ones I could probably get 2.8 since I'm on air, since I don't, I'm limited to 2.52 and if I go much higher such as 2.6 it turns unstable no matter how much voltage I give short of a voltage that would fry it within days (doesn't matter to me if it will reach 6GHz if it will be a melted lump tomorrow morning to do it.) I could actually set up to 2.7 or so at this voltage and it would boot and act stable in windows, but, Prime95 fails almost immediately, so I consider it an unacceptable overclock (and it would surely crash eventually anyway considering how quickly the error occurs in Prime95...) Anyway, I think it clear that since everything else works but AVISynth, including direct encoding of AVI files that I don't need AVISynth for on numerous occasions that we couldn't blame hardware even if I had a more iffy setup. The liklihood of a hardware error somehow always ONLY affecting AVISynth but nothing else is pretty low. Not impossible, but, near to nill.

Also are you using any special plugins for AviSynth that might crash it? Post your script.
I've tried to narrow down to only the absolutely necessary because I read somewhere that someone fixed the player crashing on AVS files by removing a certain DLL. I moved all plugins I wasn't sure I'd need from the plugins folder to a backup location. The script is about as simple as you can imagine:video = AVIFileSource("Saikano03.avi", audio=false)
#video = DirectShowSource("Saikano03.avi")
audio = WAVSource("Saikano03.wav")
AudioDub(video, audio)
TextSub("Saikano03.srt")
BilinearResize(352,240)
I think I even forgot and didn't do it with the textsub the first time around, and I know I didn't do the resize until this time (not really necessary, but, I figured why not since it's being AVISynth processed anyway.) And yes, I'm using the low-res NTSC standard on purpose, it shows up about the exact same as high-res on my portable, so the better quality I get from not needing as much bitrate and just the general all-around time saved encoding is worth it (I have made many many test videos to verify that 352x240 is at least equal to full resolution 720x480. It has a widescreen button to toggle between wide and standard and it ignores the flag telling it whether to go wide or not, so loosing the ability to make a video that says it is 16:9 makes no difference.) For some reason my cheap player looks like it's resizing 720x480 downward to 352x240 and then back up or something, so it looks just as ugly whether high or low res (hey, it was a $100 player with a video input, which, at the time I got it, was unheard of.)

And last but not least can you post a (short) sample to reproduce that error? Does it only happen in TMPG batch mode or also other encoders (HC/QuEnc or just for testing VirtualDub)?
I have nowhere to upload to I guess. I'll try making a sample later if it would help I guess. It happens in TMPGEnc whether in batch mode or not -- remember, I mentioned that it happens in a video player too. I believe I recall using VirtualDubMod, and it seemed to handle things fine, but, then VDub/VDubMod tends to bypass all unnecessary filters.

EDIT: Wait, I think I may have not been remembering right about VDub. I think mainly I just remember having been able to process the video itself in that, but, no AVISynth. There was no need for AVISynth since VDub can do the same thing (albiet only one at a time or all in one big file if you need frameserving.) I'll do a more thorough test to see what's affected later when I have more time (guess I'll have to make a test file first to do this.) Point me to somewhere to upload and I'll put up whatever test file I come up with I guess.

I have a strong suspicion by the fact that it uses 100% cpu power when it freezes up like this that it's having troubles disconnecting some filter or something like that and somehow gets itself stuck in an infinite loop. So far the only other thing I've managed to do that ever froze up the player and get it stuck on 100% cpu usage like that was when I accidentally set the input video to the AVS file while using DirectShowSource (there really should be a safety in place to prevent a script from loading the exact same file name & location since .AVS and .AVI are similar enough for it to be an easy mistake.)

Nazo
15th March 2006, 23:35
Ok, I've done some further testing. It seems that creating a sample does not work. The sample functions without an issue. It struck me that the problem must be at the very end of the files, so I ran an error check in divfix and for some reason it tells me "list index out of bounds (1)" which I guess means it doesn't like something about the index. If I tell divfix to rebuild the index, it produces a file that is something to the area of 80MB smaller than the original and somehow 3 minutes shorter -- versus the original file being 24 minutes or so, so 3 minutes less should NOT be 80MB worth (I don't know how the heck it manages this without having to watch the divfix file, and the whole idea here is to encode so I can watch on my portable, so I can't do that since it would mean spoilers.) The weirdest thing though is my player still has no troubles whatsoever with that original file and it runs smoothly, even if I skip to the very end and let it run out. I seriously doubt every single one of the thirteen encodes I have was currupted in the exact same way, so either it was encoded in some way that works fine normally but a few rare things don't like or maybe the fact it was demuxed from a matroska file (using a proper tool, not VDubMod -- I know VDubMod will mess up demuxes from Matroska sometimes) somehow is related? Unfortunately, I can't come up with any filter graph that avisynth will accept through directshow (seperate thread) so demuxing is the only solution.

Any ideas what's going on here? Assuming for a moment that it is the original files at fault and not AVISynth, how do I know before it freezes things after a long encode when I have a file that AVISynth won't like, and how might I actually fix such files without loosing data?