{"record":{"id":"6a3ff5a7b41f946b","repo":"commaai/openpilot","slug":"fn","errorCode":null,"errorMessage":"{fn}","messagePattern":"\\{fn\\}","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"openpilot/tools/lib/framereader.py","lineNumber":43,"sourceCode":"    self._cache.move_to_end(key)\n    return self._cache[key]\n\n  def __setitem__(self, key, value):\n    self._cache[key] = value\n    if len(self._cache) > self.capacity:\n      self._cache.popitem(last=False)\n\n  def __contains__(self, key):\n    return key in self._cache\n\ndef assert_hvec(fn: str) -> None:\n  with FileReader(fn) as f:\n    header = f.read(4)\n  if len(header) == 0:\n    raise DataUnreadableError(f\"{fn} is empty\")\n  elif header == b\"\\x00\\x00\\x00\\x01\":\n    if 'hevc' not in fn:\n      raise NotImplementedError(fn)\n\ndef decompress_video_data(rawdat, w, h, pix_fmt=\"rgb24\", vid_fmt='hevc', hwaccel=\"auto\", loglevel=\"info\") -> np.ndarray:\n  threads = os.getenv(\"FFMPEG_THREADS\", \"0\")\n  args = [\"ffmpeg\", \"-v\", loglevel,\n          \"-threads\", threads,\n          \"-hwaccel\", hwaccel,\n          \"-c:v\", \"hevc\",\n          \"-vsync\", \"0\",\n          \"-f\", vid_fmt,\n          \"-flags2\", \"showall\",\n          \"-i\", \"pipe:0\",\n          \"-f\", \"rawvideo\",\n          \"-pix_fmt\", pix_fmt,\n          \"pipe:1\"]\n  dat = subprocess.check_output(args, input=rawdat)\n\n  ret: np.ndarray\n  if pix_fmt == \"rgb24\":","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/tools/lib/framereader.py#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom routes encoded with h264 instead of hevc; renaming camera files; processing third-party video not produced by openpilot's encoder.","solutions":["Feed the library files whose names contain 'hevc' AND that actually contain HEVC (openpilot's default camera format)","If your data is H.264, re-encode it to HEVC first: ffmpeg -i in.h264 -c:v libx265 out.hevc","If the file genuinely is HEVC but misnamed, rename it so 'hevc' appears in the filename"],"exampleFix":"// before\nfr = FrameReader('route/camera.mp4')  # h264 annex-b data\n\n// after\nimport subprocess\nsubprocess.run(['ffmpeg', '-i', 'route/camera.mp4', '-c:v', 'libx265', '-bsf:v', 'hevc_mp4toannexb', 'route/camera.hevc'])\nfr = FrameReader('route/camera.hevc')","handlingStrategy":"validation","validationCode":"def is_likely_hevc_file(fn: str) -> bool:\n    return 'hevc' in os.path.basename(fn).lower()","typeGuard":null,"tryCatchPattern":"try:\n    fr = FrameReader(fn)\nexcept NotImplementedError:\n    convert_to_hevc(fn)  # ffmpeg re-encode then retry","preventionTips":["Keep 'hevc' in camera filenames; openpilot conventions already do this","Encode custom videos with libx265 + annex-B before framereader","Never feed h264 annex-B files — they share the 00 00 00 01 header signature"],"tags":["video","codec","framereader","not-implemented"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}