dashcam: reduce recording to 10fps (skip every other frame)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 01:40:06 -05:00
parent 6de3a8c68f
commit 24f29dcfb7
2 changed files with 7 additions and 1 deletions

View File

@@ -64,7 +64,8 @@
const std::string VIDEOS_BASE = "/data/media/0/videos";
const int SEGMENT_SECONDS = 180; // 3 minutes
const int CAMERA_FPS = 20;
const int SOURCE_FPS = 20;
const int CAMERA_FPS = 10;
const int FRAMES_PER_SEGMENT = SEGMENT_SECONDS * CAMERA_FPS;
const int BITRATE = 2500 * 1024; // 2500 kbps
const double IDLE_TIMEOUT_SECONDS = 600.0; // 10 minutes
@@ -151,6 +152,7 @@ int main(int argc, char *argv[]) {
OmxEncoder *encoder = nullptr;
std::string trip_dir;
int frame_count = 0;
int recv_count = 0;
uint64_t segment_start_ts = 0;
double idle_timer_start = 0.0;
@@ -227,6 +229,10 @@ int main(int argc, char *argv[]) {
VisionBuf *buf = vipc.recv();
if (buf == nullptr) continue;
// CLEARPILOT: skip frames to match target FPS (SOURCE_FPS -> CAMERA_FPS)
recv_count++;
if (SOURCE_FPS > CAMERA_FPS && (recv_count % (SOURCE_FPS / CAMERA_FPS)) != 0) continue;
sm.update(0);
double now = nanos_since_boot() / 1e9;