class_docstr: Class for video byte-level reading with ffmpeg.
class_docstr_tok: ["Class","for","video","byte-level","reading","with","ffmpeg","."]
docstr: Opens the file, creates the pipe.
  
  Sets self.pos to the appropriate value (1 if start_time == 0 because
  it pre-reads the first frame).
docstr_tok: ["Opens","the","file",",","creates","the","pipe",".","Sets","self.pos","to","the","appropriate","value","(","1","if","start_time","==","0","because","it","pre-reads","the","first","frame",")","."]
code: def initialize(self, start_time=0):
      """
      Opens the file, creates the pipe.
  
      Sets self.pos to the appropriate value (1 if start_time == 0 because
      it pre-reads the first frame).
      """
      self.close(delete_lastread=False)  # if any
  
      if start_time != 0:
          offset = min(1, start_time)
          i_arg = [
              "-ss",
              "%.06f" % (start_time - offset),
              "-i",
              self.filename,
              "-ss",
              "%.06f" % offset,
          ]
      else:
          i_arg = ["-i", self.filename]
  
      cmd = (
          [FFMPEG_BINARY]
          + i_arg
          + [
              "-loglevel",
              "error",
              "-f",
              "image2pipe",
              "-vf",
              "scale=%d:%d" % tuple(self.size),
              "-sws_flags",
              self.resize_algo,
              "-pix_fmt",
              self.pixel_format,
              "-vcodec",
              "rawvideo",
              "-",
          ]
      )
      popen_params = cross_platform_popen_params(
          {
              "bufsize": self.bufsize,
              "stdout": sp.PIPE,
              "stderr": sp.PIPE,
              "stdin": sp.DEVNULL,
          }
      )
      self.proc = sp.Popen(cmd, **popen_params)
  
      # self.pos represents the (0-indexed) index of the frame that is next in line
      # to be read by self.read_frame().
      # Eg when self.pos is 1, the 2nd frame will be read next.
      self.pos = self.get_frame_number(start_time)
      self.lastread = self.read_frame()
  
imports: import os
  import re
  import subprocess
  import warnings
  import numpy
  from moviepy.config import FFMPEG_BINARY
  from moviepy.tools import convert_to_seconds, cross_platform_popen_params
label_desc: Use image node_id 2 for calling the FFMPEG_VideoReader obj's underlying member method code with example usage: obj.initialize(start_time) without return types