class_docstr: Video dataset from file.
  
  This class requires that OpenCV be installed.
class_docstr_tok: ["Video","dataset","from","file",".","This","class","requires","that","OpenCV","be","installed","."]
docstr: Try different codecs, see which are available.
  Returns a dictionary with of available codecs with codecs as keys and file extensions as values.
docstr_tok: ["Try","different","codecs",",","see","which","are","available",".","Returns","a","dictionary","with","of","available","codecs","with","codecs","as","keys","and","file","extensions","as","values","."]
code: def get_available_codecs() -> dict[str, str]:
      """Try different codecs, see which are available.
      Returns a dictionary with of available codecs with codecs as keys and file extensions as values.
      """
      if not has_cv2:
          return {}
      all_codecs = {
          "mp4v": ".mp4",
          "X264": ".avi",
          "H264": ".mp4",
          "MP42": ".mp4",
          "MJPG": ".mjpeg",
          "DIVX": ".avi",
      }
      codecs = {}
      with SuppressStderr():
          writer = cv2.VideoWriter()
          with tempfile.TemporaryDirectory() as tmp_dir:
              for codec, ext in all_codecs.items():
                  fname = os.path.join(tmp_dir, f"test{ext}")
                  fourcc = cv2.VideoWriter_fourcc(*codec)
                  noviderr = writer.open(fname, fourcc, 1, (10, 10))
                  if noviderr:
                      codecs[codec] = ext
          writer.release()
      return codecs
  
imports: from __future__ import annotations
  import os
  import sys
  import tempfile
  from collections.abc import Callable
  from typing import TYPE_CHECKING, Any
  import numpy
  from torch.utils.data import Dataset, IterableDataset
  from monai.utils.enums import ColorOrder
  from monai.utils.module import optional_import
label_desc: Use image node_id 2 for calling the VideoFileDataset obj's underlying member method code with example usage: obj.get_available_codecs() and returns: codecs, dict