code: def video2frames(video_path, outpath, frame_rate=25, **kargs):
      def _dict2str(kargs):
          cmd_str = ""
          for k, v in kargs.items():
              cmd_str += " " + str(k) + " " + str(v)
          return cmd_str
  
      ffmpeg = ["ffmpeg ", " -y -loglevel ", " error "]
      vid_name = os.path.basename(video_path).split(".")[0]
      out_full_path = os.path.join(outpath, vid_name)
  
      if not os.path.exists(out_full_path):
          os.makedirs(out_full_path)
  
      # video file name
      outformat = os.path.join(out_full_path, "%05d.jpg")
  
      cmd = ffmpeg
      cmd = ffmpeg + [
          " -i ",
          video_path,
          " -r ",
          str(frame_rate),
          " -f image2 ",
          outformat,
      ]
      cmd = "".join(cmd) + _dict2str(kargs)
  
      if os.system(cmd) != 0:
          raise RuntimeError(
              "ffmpeg process video: {} error".format(video_path)
          )
          sys.exit(-1)
  
      sys.stdout.flush()
      return out_full_path
  
imports: import time
  import os
  import sys
  import ast
  import argparse
label_desc: Use image node_id 3 for calling a global function with example usage: video2frames(video_path, outpath, frame_rate) and returns: out_full_path, cmd_str