Miscellaneous Topics
Raspberry Pi
Fisheye USB Camera on Raspberry Pi
- The team says it would be cool to stream video from the robot back to the drivestation
- To offload the Roborio, use a Raspberry Pi to interface the FishEye Camera
First Steps
The page below documents some exploratory steps to display video from a 180-degree FishEye USB Camera
- Ensure the following tools are installed on the RaspBerry Pi
ffmpeg ffplay v4l2-ctl
Use command: which <tool>, where <tool> is one of the tools from list above
- If not already present, install:
sudo apt install ffmpeg ffplay v4l2
- Ensure the FishEye camera is connected to the Raspberry Pi
- Show all available Video Cameras
v4l2-ctl --list-devices
Camera should show as /dev/video0 or /dev/video1. Determine which device it is by running this command if necessary:
dmesg
- Examples below assume that the device is /dev/video1.
- To show video formats that the camera supports:
ffmpeg -f v4l2 -list_formats all -i /dev/video1
- To record to a file "output.mp4" using USB Camera device "/dev/video1".
- The example below uses the highest resolution that the FishEye Camera was found to support: 1920x1080 (HD resolution)
ffmpeg -f v4l2 -framerate 25 -video_size 1920x1080 -i /dev/video1 output.mp4
- Play the recorded file
ffplay ./output.mp4
- To display the camera's video directly without recording
ffplay -f v4l2 -framerate 25 -video_size 1920x1080 -i /dev/video1
Online reference for above
- Using a USB Camera with ffplay/ffmpeg tools: https://trac.ffmpeg.org/wiki/Capture/Webcam
Next Steps
The steps documented above record to or play locally on the Raspberry Pi.
We need to take this to the next level and stream to a different PC, possibly the drive-station if that is legal.
- Use ffmpeg to record from Fisheye camera to a local video file using MPEG2 or MPEG4 compression
- Stream the above compressed video from Raspberry Pi to a network-connected PC (Windows preferably). Tools to explore:
ffplay or ffmpeg FFPlay/FFmpeg Documentation
- Pre-requisite for above: explore Windows or Linux players that can handle the video stream.
- Explore doing the same streaming as above using UDP if not already used in streaming step above. UDP would be probably better for the environment that prevails at game venues.
- Fine tune using different video formats, bitrates. See suggested reading section below.
Suggested reading
Below we suggest a few initial resources to get you started, but do your own research as well
- Learn about:
Video
Some networking concepts
- Overview of networking
- Networking data rate and bandwidths
- Packets in networking
- Network Congestion
- Network Transports
Learn the difference between connection-oriented and datagram-oriented protocols