From 283427a153fbe7001e2d2dbba28b23eb1874815e Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Fri, 11 Apr 2025 19:22:12 -0700 Subject: [PATCH] test --- test.py | 10 ++++++++++ tools/lib/framereader.py | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 test.py diff --git a/test.py b/test.py new file mode 100755 index 0000000000..0d7c5c7ee0 --- /dev/null +++ b/test.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +from openpilot.tools.lib.framereader import FrameReader +from openpilot.tools.lib.route import Route + +TEST_ROUTE = "a2a0ccea32023010|2023-07-27--13-01-19" +route = Route(TEST_ROUTE) +segnum = 2 + +road_img = FrameReader(route.camera_paths()[segnum]).get(0, pix_fmt="nv12") diff --git a/tools/lib/framereader.py b/tools/lib/framereader.py index 7c01992a28..1361769505 100644 --- a/tools/lib/framereader.py +++ b/tools/lib/framereader.py @@ -173,7 +173,7 @@ def decompress_video_data(rawdat, vid_fmt, w, h, pix_fmt): "-threads", threads, "-hwaccel", "none" if not cuda else "cuda", "-c:v", "hevc", - "-vsync", "0", + #"-fps_mode", "passthrough", "-f", vid_fmt, "-flags2", "showall", "-i", "-", @@ -181,6 +181,7 @@ def decompress_video_data(rawdat, vid_fmt, w, h, pix_fmt): "-f", "rawvideo", "-pix_fmt", pix_fmt, "-"] + print(' '.join(args)) dat = subprocess.check_output(args, input=rawdat) if pix_fmt == "rgb24": @@ -490,6 +491,7 @@ class GOPFrameReader(BaseFrameReader): ret = decompress_video_data(rawdat, self.vid_fmt, self.w, self.h, pix_fmt) ret = ret[skip_frames:] + print(ret.shape, num_frames, self.w, self.h) assert ret.shape[0] == num_frames for i in range(ret.shape[0]):