videophool
1st December 2008, 21:53
I have a batch encoding tool that uses AVISynth to read frames from the source file, using an AVS input. Occasionally, there is an IO error (appears to be NW problem). My expectation is that AVISynth would exit with an error code. However, what happens is that the error message is encoded into the video frame. The message is "The video Graph failed to restart after seeking. Status = <HRESULT>". I see this beign thrown from DirectShowSource::GetFrame. Unfortunately, I can not reproduce in a debug environment. Any ideas?
The avs file looks like this.
LoadPlugin("...autocrop.dll")
LoadPlugin("...Decomb.dll")
LoadPlugin("...TDeint.dll")
src_movie = DirectShowSource("MyMovie.mpg",video=true,audio=false,fps=23.976,seek=true).ConvertToYV12()
src_width = width(src_movie)
src_height = height(src_movie)
src_movie = ( ( src_width % 4 == 0 ) ? src_movie : LanczosResize(src_movie,src_width + 2 ,src_height - 4 ) )
cropclip = autocrop(src_movie, mode = 0, wmultof = 4, hmultof = 4, samples = 16, aspect = 0, threshold = 25, samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
c_width = width(cropclip)
fixed_aspect = 0.88888888888889
c_height = round(Height(cropclip) / fixed_aspect)
input_par = float(c_width) / float(c_height)
final_width = input_par < 1.50 ? 512 : 640
out_height = round(float(final_width) / input_par)
hmod = out_height - (floor(out_height / 8) * 8)
out_height = (hmod > 2) ? (out_height + (4 - hmod)) : (out_height - hmod)
new_aspect = (float(final_width) / float(out_height)) / fixed_aspect
crop_movie = autocrop(src_movie, mode = 0, wmultof = 4, hmultof = 4, samples = 16, aspect = 0, threshold = 25, samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
final_height = ( int(out_height/2) * 2 == out_height) ? out_height : out_height + 1
final_movie = LanczosResize(crop_movie,final_width,final_height)
final_movie
The avs file looks like this.
LoadPlugin("...autocrop.dll")
LoadPlugin("...Decomb.dll")
LoadPlugin("...TDeint.dll")
src_movie = DirectShowSource("MyMovie.mpg",video=true,audio=false,fps=23.976,seek=true).ConvertToYV12()
src_width = width(src_movie)
src_height = height(src_movie)
src_movie = ( ( src_width % 4 == 0 ) ? src_movie : LanczosResize(src_movie,src_width + 2 ,src_height - 4 ) )
cropclip = autocrop(src_movie, mode = 0, wmultof = 4, hmultof = 4, samples = 16, aspect = 0, threshold = 25, samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
c_width = width(cropclip)
fixed_aspect = 0.88888888888889
c_height = round(Height(cropclip) / fixed_aspect)
input_par = float(c_width) / float(c_height)
final_width = input_par < 1.50 ? 512 : 640
out_height = round(float(final_width) / input_par)
hmod = out_height - (floor(out_height / 8) * 8)
out_height = (hmod > 2) ? (out_height + (4 - hmod)) : (out_height - hmod)
new_aspect = (float(final_width) / float(out_height)) / fixed_aspect
crop_movie = autocrop(src_movie, mode = 0, wmultof = 4, hmultof = 4, samples = 16, aspect = 0, threshold = 25, samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
final_height = ( int(out_height/2) * 2 == out_height) ? out_height : out_height + 1
final_movie = LanczosResize(crop_movie,final_width,final_height)
final_movie