How to set up an OrangePi PC2 with 3 USB cams as RTSP Server

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
Sigge
Posts: 116
Joined: Mon May 02, 2016 8:14 am

How to set up an OrangePi PC2 with 3 USB cams as RTSP Server

Post by Sigge »

If anyone else wants to do this;

The H5 boards do not have stable Armbian yet so a H3 board might be better. It is also simpler, no need to swap libyuv module in the v4l2tools.

-- Prepare --

Install Armbian. In my case "ARMBIAN 5.52.180717 nightly Debian GNU/Linux 9 (stretch) 4.17.7-sunxi64"
Install headers in armbian-config. (twitchy, needs to be done first of all.)
sudo apt-get install bison libbison-dev flex libfl-dev
cd /usr/src/linux-headers-4.17.7-sunxi64/
sudo make scripts

-- v4l2loopback --

git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback/
make && sudo make install
sudo depmod -a

freeze kernel in armbian-config

-- libv4l2cpp --

sudo apt-get install liblog4cpp5-dev
git clone https://github.com/mpromonet/libv4l2cpp.git
cd libv4l2cpp/
make
sudo mkdir /usr/include/libv4l2cpp/
sudo make install

-- v4l2tools --

sudo apt-get install libvpx-dev libx264-dev libx265-dev libjpeg-dev libtool
git clone https://github.com/mpromonet/v4l2tools.git
cd v4l2tools/
make
sudo make install

--> for aarch64-linux <--
you need to swap libyuv module to: https://github.com/webrtc-uwp/libyuv
not sure how I made this work :(

-- v4l2rtspserver --

sudo apt-get install liblivemedia-dev
git clone https://github.com/mpromonet/v4l2rtspserver.git
cd v4l2rtspserver/
cd v4l2wrapper
mkdir inc
cd inc
cp /usr/include/libv4l2cpp/* .
cd ..
cd ..
cmake .
make

-- setup --

sudo apt-get install v4l-utils
v4l2-ctl -d /dev/video0 -vwidth=1280,height=960,pixelformat=YUYV -p 5
v4l2-ctl -d /dev/video1 -vwidth=1280,height=960,pixelformat=YUYV -p 5
v4l2-ctl -d /dev/video2 -vwidth=1280,height=960,pixelformat=YUYV -p 5
sudo modprobe v4l2loopback video_nr=10,11,12
v4l2compress_h264 -W1280 -H960 -F5 /dev/video0 /dev/video10
./v4l2rtspserver -W1280 -H960 -F5 /dev/video10

v4l2compress_h264 -P8555 -W1280 -H960 -F5 /dev/video1 /dev/video11
./v4l2rtspserver -W1280 -H960 -F5 /dev/video11

v4l2compress_h264 -P8556 -W1280 -H960 -F5 /dev/video2 /dev/video12
./v4l2rtspserver -W1280 -H960 -F5 /dev/video12
Post Reply