Closed n8thenetninja closed 7 years ago
Another possibility helpful link: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=45793
Instructions for another rtsp server for raspberry pi
RTSP streaming from the R-Pi works. The stream can be viewed on a LAN with a desktop application, but the Android app can't connect to it. This seems to be due to android expecting a video length instead of a live stream. I also tried the Vitamio library, but the project has apparently been abandoned since Android dependency version 22, and Gradle won't let me use anything lower than 24. Now exploring other libraries such as ExoPlayer
I figured out how to switch "target version" to 22. The android app now plays the RTSP stream using the Vitamio library. It's choppy for a couple minutes, but smooths out eventually. I think this is Android ramping up system resources to handle the extra load. Lag is higher than I would like, but that also goes down after it's been running for a bit. Around half a second was observed after waiting a few minutes. It can be up to 1s however. It might be possible to get it down by modifying the buffer settings etc.
The video is about as quick as it's likely to get on Android at least. A test in a large parking lot seems to be in order to see how drivable the car is.
(Finished by N8thenetninja)
The video stream needs to have the least amount of lag possible. This probably means hardware video processing, and a fast network protocol. V4L2 is the hardware library for raspberry pi camera (not to be confused with V4L). Real Time Streaming Protocol (RTSP) might be an avenue to explore.
I haven't read through this yet, but it sounds like it might be helpful: https://www.rs-online.com/designspark/building-a-raspberry-pi-2-webrtc-camera
Here is a Python library for RTSP that might be useful too: https://github.com/odie5533/Python-RTSP
Note: This doesn't necessarily have to be part of the control script. We're running a full Linux OS, so it can be it's own program running in parallel.
Another note: Research beyond the two links in this issue will most likely be required. Use your own judgment.