code: def test_ffmpeg_write_video(
      util,
      codec,
      is_valid_codec,
      ext,
      write_logfile,
      with_mask,
      bitrate,
      threads,
  ):
      filename = os.path.join(
          util.TMP_DIR, f"moviepy_ffmpeg_write_video{ext}"
      )
      if os.path.isfile(filename):
          try:
              os.remove(filename)
          except PermissionError:
              pass
  
      logfile_name = filename + ".log"
      if os.path.isfile(logfile_name):
          os.remove(logfile_name)
  
      clip = BitmapClip([["R"], ["G"], ["B"]], fps=10).with_duration(
          0.3
      )
      if with_mask:
          clip = clip.with_mask(
              BitmapClip(
                  [["W"], ["O"], ["O"]], fps=10, is_mask=True
              ).with_duration(0.3)
          )
  
      kwargs = dict(
          logger=None,
          write_logfile=write_logfile,
          with_mask=with_mask,
      )
      if codec is not None:
          kwargs["codec"] = codec
      if bitrate is not None:
          kwargs["bitrate"] = bitrate
      if threads is not None:
          kwargs["threads"] = threads
  
      ffmpeg_write_video(clip, filename, 10, **kwargs)
  
      if is_valid_codec:
          assert os.path.isfile(filename)
  
          final_clip = VideoFileClip(filename)
  
          r, g, b = final_clip.get_frame(0)[0][0]
          assert r == 254
          assert g == 0
          assert b == 0
  
          r, g, b = final_clip.get_frame(0.1)[0][0]
          assert r == (0 if not with_mask else 1)
          assert g == (255 if not with_mask else 1)
          assert b == 1
  
          r, g, b = final_clip.get_frame(0.2)[0][0]
          assert r == 0
          assert g == 0
          assert b == (255 if not with_mask else 0)
  
      if write_logfile:
          assert os.path.isfile(logfile_name)
  
file_path: moviepy/tests/test_ffmpeg_writer.py
imports: import multiprocessing
  import os
  from PIL import Image
  import pytest
  from moviepy.video.compositing.concatenate import concatenate_videoclips
  from moviepy.video.io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
  from moviepy.video.io.gif_writers import write_gif
  from moviepy.video.io.VideoFileClip import VideoFileClip
  from moviepy.video.tools.drawing import color_gradient
  from moviepy.video.VideoClip import BitmapClip, ColorClip
label_desc: Use image node_id 1 for calling a global function with example usage: test_ffmpeg_write_video(util, codec, is_valid_codec, ext, write_logfile, with_mask, bitrate, threads) without return types