Answers.Body: <pre><code>FirstFrame      = 1
  ......
  ......    
  Raw = ImageReader("GOPR%04d.JPG", FirstFrame, LastFrame, FrameRate)
  </code></pre>
  
  <p>Probably the file <code>GOPR0001.JPG</code> doesn't exist in your current directory.</p>
  
  <p>From AviSynth manual:</p>
  
  <blockquote>
    <p>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. </p>
  </blockquote>
  
  <p>For testing it directly in your script, temporary put <code>Raw  __END__</code> at the end of the command, i. e.</p>
  
  <pre><code>Raw = ImageReader("GOPR%04d.JPG", FirstFrame, LastFrame, FrameRate)  Raw  __END__
  </code></pre>
  
  <p>and play back your script (<code>.avs</code> file). If you get the same error, non-existence of the file <code>GOPR0001.JPG</code> is your problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-29T18:00:29.897Z
Answers.LastActivityDate: 2019-12-29T18:21:33.603Z
Answers.LastEditDate: 2019-12-29T18:21:33.603Z
Answers.UserDisplayName: MarianD
Body: <p>I tried to use ArrayOpArrayFunc of avslib (Avisynth plugin) to crop each frame differently based on the contents of an array.</p>
  
  <p>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?</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>The error message is 'I don't know what "Raw" means'.<br>
  The original images are 4000x3000, they need to be cropped variously (simplified version of the arrays above), then resized to final video format.</p>
  
Tags: <editing><script>
Title: avisynth(+) + avslib - cropping each frame with different values
UserDisplayName: asoundmove
ThreadText: # avisynth(+) + avslib - cropping each frame with different values
  
  (Asked by: username_0 on 2019-12-29)
  
  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.
  
  **Tags:** editing, script
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-12-29. Score: 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.
  
  
  ---
  
  