0

I tried to use ArrayOpArrayFunc of avslib (Avisynth plugin) to crop each frame differently based on the contents of an array.

I start with image files, say 20, build my arrays, and try to apply the filters, but I must make a mistake as I cannot get this to work. Any idea how to fix my script?

Import("C:\Program Files (x86)\AVSLib\avslib\loader.avsi")
Import("C:\Program Files (x86)\AVSLib\avslib\avslib.avsi")
LoadLibrary("avslib", CONFIG_AVSLIB_ARRAYS)
LoadModule("avslib", "base", "constants")
LoadModule("avslib", "filters", "frames")

dx001 = ArrayCreate(1250, 1250, 2110, 1250, 1250, 1250, 1250, 1250, 1250, 1250)
dx011 = ArrayCreate(1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250)
dx = dx001.ArrayInsRange(dx011)

dy001 = ArrayCreate(1300, 1300, 1300, 2000, 1300, 1300, 1300, 1300, 1300, 1300)
dy011 = ArrayCreate(1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300)
dy = dy001.ArrayInsRange(dy011)

FirstFrame      = 1
LastFrame       = 20
FrameRate       = 25

function MyCrop(dx, dy, clip, w, h)
{
  return Crop(clip, dx, dy, w, h)
}

Raw = ImageReader("GOPR%04d.JPG", FirstFrame, LastFrame, FrameRate)
Crop = ArrayOpArrayFunc(dx, dy, "MyCrop", "Raw,1600,1200")
BilinearResize(Crop, 800, 600)

The error message is 'I don't know what "Raw" means'.
The original images are 4000x3000, they need to be cropped variously (simplified version of the arrays above), then resized to final video format.

0
FirstFrame      = 1
......
......    
Raw = ImageReader("GOPR%04d.JPG", FirstFrame, LastFrame, FrameRate)

Probably the file GOPR0001.JPG doesn't exist in your current directory.

From AviSynth manual:

The first file in the sequence, i.e., corresponding to 'start', MUST exist in order for clip parameters to be computed. Any missing files in the sequence are replaced with a blank frame.

For testing it directly in your script, temporary put Raw __END__ at the end of the command, i. e.

Raw = ImageReader("GOPR%04d.JPG", FirstFrame, LastFrame, FrameRate)  Raw  __END__

and play back your script (.avs file). If you get the same error, non-existence of the file GOPR0001.JPG is your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.