class_docstr: Helper class for writing whole videos.
class_docstr_tok: ["Helper","class","for","writing","whole","videos","."]
docstr: Initializes ffmpeg to write frames.
code: def __init_ffmpeg(self, image_shape):
      """Initializes ffmpeg to write frames."""
      import itertools  # pylint: disable=g-import-not-at-top
      from subprocess import (
          Popen,
          PIPE,
      )  # pylint: disable=g-import-not-at-top,g-multiple-import,g-importing-member
  
      ffmpeg = "ffmpeg"
      height, width, channels = image_shape
      self.cmd = [
          ffmpeg,
          "-y",
          "-f",
          "rawvideo",
          "-vcodec",
          "rawvideo",
          "-r",
          "%.02f" % self.fps,
          "-s",
          "%dx%d" % (width, height),
          "-pix_fmt",
          {1: "gray", 3: "rgb24"}[channels],
          "-i",
          "-",
          "-filter_complex",
          "[0:v]split[x][z];[x]fifo[w];[z]palettegen,fifo[y];"
          "[w][y]paletteuse,fifo",
          "-r",
          "%.02f" % self.fps,
          "-f",
          self.file_format,
          "-qscale",
          "0",
          "-",
      ]
      self.proc = Popen(
          self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1
      )
      (self._out_thread, self._err_thread) = itertools.starmap(
          self._start_reader_thread,
          [
              (self.proc.stdout, self._out_chunks),
              (self.proc.stderr, self._err_chunks),
          ],
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import contrib
  import tensorflow.compat.v1
  from tensorflow.python.ops import summary_op_util
label_desc: Use image node_id 2 for calling the WholeVideoWriter obj's underlying member method code with example usage: obj.__init_ffmpeg(image_shape) without return types