class_docstr: Class for video byte-level reading with ffmpeg.
class_docstr_tok: ["Class","for","video","byte-level","reading","with","ffmpeg","."]
code: def __init__(
      self,
      filename,
      decode_file=True,
      print_infos=False,
      bufsize=None,
      pixel_format="rgb24",
      check_duration=True,
      target_resolution=None,
      resize_algo="bicubic",
      fps_source="fps",
  ):
      self.filename = filename
      self.proc = None
      infos = ffmpeg_parse_infos(
          filename,
          check_duration=check_duration,
          fps_source=fps_source,
          decode_file=decode_file,
          print_infos=print_infos,
      )
      self.fps = infos["video_fps"]
      self.size = infos["video_size"]
  
      # ffmpeg automatically rotates videos if rotation information is
      # available, so exchange width and height
      self.rotation = abs(infos.get("video_rotation", 0))
      if self.rotation in [90, 270]:
          self.size = [self.size[1], self.size[0]]
  
      if target_resolution:
          if None in target_resolution:
              ratio = 1
              for idx, target in enumerate(target_resolution):
                  if target:
                      ratio = target / self.size[idx]
              self.size = (
                  int(self.size[0] * ratio),
                  int(self.size[1] * ratio),
              )
          else:
              self.size = target_resolution
      self.resize_algo = resize_algo
  
      self.duration = infos["video_duration"]
      self.ffmpeg_duration = infos["duration"]
      self.n_frames = infos["video_n_frames"]
      self.bitrate = infos["video_bitrate"]
  
      self.infos = infos
  
      self.pixel_format = pixel_format
      self.depth = 4 if pixel_format[-1] == "a" else 3
      # 'a' represents 'alpha' which means that each pixel has 4 values instead of 3.
      # See https://github.com/Zulko/moviepy/issues/1070#issuecomment-644457274
  
      if bufsize is None:
          w, h = self.size
          bufsize = self.depth * w * h + 100
  
      self.bufsize = bufsize
      self.initialize()
  
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 1 to create a new FFMPEG_VideoReader object  with example: obj = FFMPEG_VideoReader(filename, decode_file, print_infos, bufsize, pixel_format, check_duration, target_resolution, resize_algo, fps_source)