commaai/openpilot · error · NotImplementedError

{fn}

Error message

{fn}

What it means

Thrown by assert_hvec() when the file's 4-byte header matches the HEVC annex-B start code b'\x00\x00\x00\x01' but the filename does not contain the substring 'hevc'. The library uses the filename to confirm the stream really is HEVC; a start-code header on a non-hevc-named file is treated as unsupported. This is a NotImplementedError, meaning the format is intentionally out of scope.

Source

Thrown at openpilot/tools/lib/framereader.py:43

    self._cache.move_to_end(key)
    return self._cache[key]

  def __setitem__(self, key, value):
    self._cache[key] = value
    if len(self._cache) > self.capacity:
      self._cache.popitem(last=False)

  def __contains__(self, key):
    return key in self._cache

def assert_hvec(fn: str) -> None:
  with FileReader(fn) as f:
    header = f.read(4)
  if len(header) == 0:
    raise DataUnreadableError(f"{fn} is empty")
  elif header == b"\x00\x00\x00\x01":
    if 'hevc' not in fn:
      raise NotImplementedError(fn)

def decompress_video_data(rawdat, w, h, pix_fmt="rgb24", vid_fmt='hevc', hwaccel="auto", loglevel="info") -> np.ndarray:
  threads = os.getenv("FFMPEG_THREADS", "0")
  args = ["ffmpeg", "-v", loglevel,
          "-threads", threads,
          "-hwaccel", hwaccel,
          "-c:v", "hevc",
          "-vsync", "0",
          "-f", vid_fmt,
          "-flags2", "showall",
          "-i", "pipe:0",
          "-f", "rawvideo",
          "-pix_fmt", pix_fmt,
          "pipe:1"]
  dat = subprocess.check_output(args, input=rawdat)

  ret: np.ndarray
  if pix_fmt == "rgb24":

View on GitHub (pinned to 516ec1e682)

Solutions

  1. Feed the library files whose names contain 'hevc' AND that actually contain HEVC (openpilot's default camera format)
  2. If your data is H.264, re-encode it to HEVC first: ffmpeg -i in.h264 -c:v libx265 out.hevc
  3. If the file genuinely is HEVC but misnamed, rename it so 'hevc' appears in the filename

Example fix

// before
fr = FrameReader('route/camera.mp4')  # h264 annex-b data

// after
import subprocess
subprocess.run(['ffmpeg', '-i', 'route/camera.mp4', '-c:v', 'libx265', '-bsf:v', 'hevc_mp4toannexb', 'route/camera.hevc'])
fr = FrameReader('route/camera.hevc')
Defensive patterns

Strategy: validation

Validate before calling

def is_likely_hevc_file(fn: str) -> bool:
    return 'hevc' in os.path.basename(fn).lower()

Try / catch

try:
    fr = FrameReader(fn)
except NotImplementedError:
    convert_to_hevc(fn)  # ffmpeg re-encode then retry

Prevention

When it happens

Trigger: Passing a raw H.264/AVC annex-B file (which shares the 00 00 00 01 start code) or any renamed HEVC file lacking 'hevc' in its name to FrameReader/get_video_index. E.g. reading an fcamera file that was actually encoded as h264, or a custom .mp4 remux.

Common situations: Custom routes encoded with h264 instead of hevc; renaming camera files; processing third-party video not produced by openpilot's encoder.

Related errors


AI-assisted analysis of commaai/openpilot@516ec1e682 (2026-08-15). Data as JSON: /api/errors/6a3ff5a7b41f946b. Report an issue: GitHub.