code: def test_write(pixfmts):
      """
      Testing `frame_format` with different pixel formats.
      """
      source = return_testvideo_path(fmt="vo")
      try:
          # formulate the decoder with suitable source(for e.g. foo.mp4)
          if pixfmts != "invalid2":
              decoder = FFdecoder(
                  source,
                  frame_format=pixfmts,
                  custom_ffmpeg=return_static_ffmpeg(),
              ).formulate()
              output_params = {
                  "-input_pixfmt": pixfmts,
              }
          else:
              decoder = FFdecoder(
                  source,
                  custom_ffmpeg=return_static_ffmpeg(),
              )
              # assign manually pix-format via `metadata` property object {special case}
              decoder.metadata = dict(output_frames_pixfmt="yuvj422p")
              # formulate decoder
              decoder.formulate()
              output_params = {
                  "-input_pixfmt": "yuvj422p",
              }
          writer = WriteGear(
              output="Output_tw.mp4",
              custom_ffmpeg=return_static_ffmpeg(),
              **output_params,
          )  # Define writer
          # grab RGB24(default) 3D frames from decoder
          for frame in decoder.generateFrame():
              # lets write it
              writer.write(frame)
          decoder.terminate()
          writer.close()
          basepath, _ = os.path.split(return_static_ffmpeg())
          ffprobe_path = os.path.join(
              basepath, "ffprobe.exe" if os.name == "nt" else "ffprobe"
          )
          assert os.path.isfile(ffprobe_path), "FFprobe not Found!"
          result = check_output(
              [
                  ffprobe_path,
                  "-v",
                  "error",
                  "-count_frames",
                  "-i",
                  os.path.abspath("Output_tw.mp4"),
              ]
          )
          if result:
              if not isinstance(result, string_types):
                  result = result.decode()
              assert not any(
                  x in result
                  for x in ["Error", "Invalid", "error", "invalid"]
              ), "Test failed!"
      except Exception as e:
          pytest.fail(str(e))
      finally:
          remove_file_safe("Output_tw.mp4")
  
imports: import os
  import re
  import cv2
  import pytest
  import logging
  import platform
  import tempfile
  import subprocess
  from six import string_types
  from deffcode import FFdecoder
  from vidgear.gears import WriteGear
  from vidgear.gears.helper import check_output, logger_handler
label_desc: Use image node_id 7 for calling a global function with example usage: test_write(pixfmts) without return types