[Martin] has a Lotus Elise and access to a track. Sounds like fun, huh? The only problem is that the dashcam videos he makes are a little bit boring. Sure, they show him flying around the track, but without some sort of data it’s really hard to improve his driving skills. After thinking about it for a while, [Martin] decided he could use his Raspberry Pi and camera module to record videos from the dashboard of his car, and overlay engine data such as RPM, throttle, and speed right on top of the video.
Capturing video is the easy part of this build – [Martin] just connected his Raspi camera module and used the standard raspivid capture utility. Overlaying data on this captured video was a bit harder, though.
[Martin] had previously written about using the Raspi to read OBD-II data into his Raspi. Combine this with a Python script to write subtitles for his movies, and he’s off to the races, with a video and data replay of every move on the track.
The resulting movie and subtitle files can be reencoded to an HD movie. Reencoding a 13 minute HD video took 9 hours on the Raspi. We’d suggest doing this with a more powerful compy, but at least [Martin] has a great solution to fix his slightly uninformative track videos.
The Pi has hardware-accelerated h.264 encoding (which is how it saves the movies in realtime in the first place). RaspiVid leverages Broadcom’s “MMAL” pipeline-based multimedia processing API for this, basically connecting the camera output to the encoder input, and saving out the encoder output. It would be possible to do the overlay in a custom-written MMAL component, attached between the camera and the encoder.
This is definitely on the list of things to do, but little steps and all that!
This is cool and all, but I feel that torque is a simple and cheap enough solution.
And it wont have the ridiculous render time. To each his own.
I have been wanting to do this for everyday driving and security. My plan was to put a RasPi in my car with a webcam as a dashcam/security camera using motion to record the frames. I thought it would be cool to overlay GPS and speed info on the frames with/instead of time/date. Two issues, one was that motion didn’t allow for overlay of text like that second the RasPi would choke on large frame pics. I could only get it to record 150×150 pixel pictures. I think it was lag in the USB chip or hub that was preventing full 720p frames.
I got a RasPi camera module the other day and plan to try again, I still would like to overlay info from GPSd on the frames. This seems promising.
Nice idea,but why not use soft subs and avoid re-encoding the video?
He did it the hard way. There are several libraries to overlay text on video directly under linux, he should have looked at the DIY UAV and robotics forums.
Very cool. Gotta say, it’d be way more entertaining if there was audio too. Of the engine, of course, not some cheesy music soundtrack.
Another thing that might be interesting, maybe even helpful, would be a brake indicator. Just a dot in the telemetry display that appears when you hit the binders.
though adding a linear potentiometer to display a percentage of brake travel might be more useful in a track setting instead of just an indicator.
That depends. IIRC, Formula 1 telemetry generally shows that race drivers use brakes (and throttle) pretty much as on/off switches. It makes sense; if you’re braking at something less than 100%, you could shave off a fraction of a second by braking slightly later instead.
On the other hand, if you can get the full position data, it would be interesting to use it to see how true that is in this case.
Would be a lot more relevant if we knew what gear the car is in. Ok so the throttle is open 100% and your doing 68mph… in a Lotus… Just saying