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:
Binary file not shown.
@@ -64,7 +64,8 @@
|
|||||||
|
|
||||||
const std::string VIDEOS_BASE = "/data/media/0/videos";
|
const std::string VIDEOS_BASE = "/data/media/0/videos";
|
||||||
const int SEGMENT_SECONDS = 180; // 3 minutes
|
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 FRAMES_PER_SEGMENT = SEGMENT_SECONDS * CAMERA_FPS;
|
||||||
const int BITRATE = 2500 * 1024; // 2500 kbps
|
const int BITRATE = 2500 * 1024; // 2500 kbps
|
||||||
const double IDLE_TIMEOUT_SECONDS = 600.0; // 10 minutes
|
const double IDLE_TIMEOUT_SECONDS = 600.0; // 10 minutes
|
||||||
@@ -151,6 +152,7 @@ int main(int argc, char *argv[]) {
|
|||||||
OmxEncoder *encoder = nullptr;
|
OmxEncoder *encoder = nullptr;
|
||||||
std::string trip_dir;
|
std::string trip_dir;
|
||||||
int frame_count = 0;
|
int frame_count = 0;
|
||||||
|
int recv_count = 0;
|
||||||
uint64_t segment_start_ts = 0;
|
uint64_t segment_start_ts = 0;
|
||||||
double idle_timer_start = 0.0;
|
double idle_timer_start = 0.0;
|
||||||
|
|
||||||
@@ -227,6 +229,10 @@ int main(int argc, char *argv[]) {
|
|||||||
VisionBuf *buf = vipc.recv();
|
VisionBuf *buf = vipc.recv();
|
||||||
if (buf == nullptr) continue;
|
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);
|
sm.update(0);
|
||||||
double now = nanos_since_boot() / 1e9;
|
double now = nanos_since_boot() / 1e9;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user