code: def _get_repr_html_ffmpeg(images: List[PilImage]) -> str:
      """Runs ffmpeg to get the mp4 encoded <video> str."""
      # Find number of digits in len to give names.
      num_digits = len(str(len(images))) + 1
      with tempfile.TemporaryDirectory() as video_dir:
          for i, img in enumerate(images):
              f = os.path.join(video_dir, f"img{i:0{num_digits}d}.png")
              img.save(f, format="png")
  
          ffmpeg_args = [
              "-framerate",
              str(_VISU_FRAMERATE),
              "-i",
              os.path.join(video_dir, f"img%0{num_digits}d.png"),
              # Using native h264 to encode video stream to H.264 codec
              # Default encoding does not seems to be supported by chrome.
              "-vcodec",
              "h264",
              # When outputting H.264, `-pix_fmt yuv420p` maximize compatibility
              # with bad video players.
              # Ref: https://trac.ffmpeg.org/wiki/Slideshow
              "-pix_fmt",
              "yuv420p",
              # ffmpeg require height/width to be even, so we rescale it
              # https://stackoverflow.com/questions/20847674/ffmpeg-libx264-height-not-divisible-by-2
              "-vf",
              "pad=ceil(iw/2)*2:ceil(ih/2)*2",
              # Native encoder cannot encode images of small scale
              # or the the hardware encoder may be busy which raises
              # Error: cannot create compression session
              # so allow software encoding
              # '-allow_sw', '1',
          ]
          video_path = epath.Path(video_dir) / "output.mp4"
          ffmpeg_args.append(os.fspath(video_path))
          utils.ffmpeg_run(ffmpeg_args)
          video_str = utils.get_base64(video_path.read_bytes())
      return (
          f'<video height="{THUMBNAIL_SIZE}" width="175" '
          "controls loop autoplay muted playsinline>"
          f'<source src="data:video/mp4;base64,{video_str}"  type="video/mp4" >'
          "</video>"
      )
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import io
  import os
  import tempfile
  from typing import Any, List, Optional, Type, Union
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import dtype_utils
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _get_repr_html_ffmpeg(images) and returns: str, THUMBNAIL_SIZE, str, video_str, str