JVital2013 / RoadApplePi

An elegent "Black Box" solution that can be retrofitted into any car with an OBD(II) port for minimal cost.
GNU General Public License v3.0
239 stars 66 forks source link

Does this support multiple cameras? #1

Open nationwide13 opened 6 years ago

nationwide13 commented 6 years ago

If not is this in the roadmap/plans?

JVital2013 commented 6 years ago

Right now it does not support multiple cameras. I have not yet experimented with encoding multiple videos/one video from multiple sources in real time, but I have my doubts about a Raspberry Pi being able to handle it. At some point I'll grab a second webcam and see what the Pi can do

anatonie commented 6 years ago

Doing some googling and it doesn't look like a single Pi could support multiple cameras sadly.

What do you use to sync the gauges with the video?

Thinking: Pi 3 - web cam, large SD card Pi Zero - web cam

Have Pi3 (master) attach the recording directory to the Pi Zero (slave) via something like samba, and when it starts recording it sends (via network or GPIO) a signal to the Pi Zero slave to begin recording to the samba directory.

Using wireless to do this would limit the resolution of the second cam, but you could potentially use something like http://raspi.tv/2015/ethernet-on-pi-zero-how-to-put-an-ethernet-port-on-your-pi to get ethernet to connect the two Pis and speed up the connection, however then you almost might as well get a second full size Pi3

I'll look through the repo and see what I can figure out

JVital2013 commented 6 years ago

The gauges are synchronized with the video by the unix timestamp. OBD values are being dumped constantly, along with the timestamp in milliseconds. On the other hand, the video files are split every 5 minutes, with the start time of the video also stored in milliseconds.

I like the master/slave idea, but I'm not a fan of having it centralized. Instead of sending the recordings to the master pi, each slave should keep their own. The Pis would all be connected to the master's AP, which the master would use to send commands to each of the slaves for things such syncing the video cuts. Then, when the user goes to view the recordings, they'll connect to the master to get the webapp like they do now. However, the additional angles' video tags would point to the respective slave to directly pull the video.

This would make it almost infinitely expandable as the load is distributed. Setup could be made relatively simple: install RoadApplePi on each pi. Connect the slaves to the master AP, then go into the webapp and "claim" the slaves. The rest of the setup would be automatic (which wouldn't be much, other than disable the web app on the slave and activate a "listener" on them to handle the commands from the master).

The biggest problem is still power. You can only use so many fuse taps, and each Pi would need its own Mausberry/SleepyPi to manage its power.

Thoughts on all this?

nationwide13 commented 6 years ago

That sounds like a cool and simple setup.

Would you tap into engine on to trigger the recording on both pis? or have the master emit a signal to slaves?

If you go with master starting the recording, you can then also have the master emit a stop recording command and have it shutdown the pi

Then you have your sleepy pi (or master pi) trigger the reset pins to wake up the slaves.

The circuit becomes a bit more complex, but I think it sounds doable without extra Mausberry/SleepPi's.

What do you think?

JVital2013 commented 6 years ago

The problem is that I like the idea of the power being cut to all the raspberry pis when the car is off to minimize battery drain. In order to achieve this, some sort of external circuit is needed for each raspberry pi to manage its power. Also, one mausberry/SleepyPi can't power more than one pi.

That being said, I have good news! I have successfully been able to encode videos from two webcams simultaneously on one raspberry pi! I can even encode them side-by-side in the same video with little performance impact. Since I've determined that this is possible, I'm going to go forward with developing multi-camera support on a single pi.

The plan is to make it record each camera to its own video file. You'll be able to name the cameras, then switch between angles in the web app. I won't cap the number of USB cameras you can connect, but YMMV with more than 2 cameras

FracKenA commented 5 years ago

Looking through the code, I do not see any branches with your pending code changes? Do you have the changes you made for the multiple cameras available for others to test and help with?

terratrooper commented 4 years ago

I would also like to know has this been solved/implemented? (Would be handy to have multiple angles/views of my "huge highway crashes")

altontoth commented 3 years ago

I'll third the question of any update? I see the code has not been updated in several years. I'm wondering if anyone has tried implementing this in their own fork yet?

mikechambers84 commented 2 years ago

Is this still going to be implemented? I have license plate cameras on the front and back of my car, and wanted to record from both with this. If someone rear-ends me, I want to make sure it's saved!