This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:farmrobot:steuerungs-kamera [2021/02/26 16:34] nicolas-leon raspberry pi setup |
projects:farmrobot:steuerungs-kamera [2021/03/14 17:51] jonas [Authors] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== FPV Camera ===== | + | ====== FPV Camera |
The FPV Camera serves a video stream as the first person view (FPV) of the Robot. This makes it possible to see the position of the Robot and anything in its way. | The FPV Camera serves a video stream as the first person view (FPV) of the Robot. This makes it possible to see the position of the Robot and anything in its way. | ||
- | ==== Hardware ==== | + | ===== Hardware |
- | A 3d Printed mount for the bosh40x40 | + | A 3d Printed mount for the Bosch40x40 |
- | [picture of 40x40 clip and camera case] | + | {{: |
+ | |||
+ | [picture of 40x40 clip with pole and camera case(n/a)] | ||
The following hardware is used for capturing and broadcasting the video stream: | The following hardware is used for capturing and broadcasting the video stream: | ||
* Raspberry Pi 4B (8GB) by element14 | * Raspberry Pi 4B (8GB) by element14 | ||
- | * Raspberry Pi CSI camera NoIR | + | * element14 |
* USB-C cable | * USB-C cable | ||
* Heatsinks | * Heatsinks | ||
Line 18: | Line 20: | ||
* SD-Card | * SD-Card | ||
- | ==== Software ==== | + | ===== Software |
The SD-Card has been flashed with an Ubuntu 20.10 arm64-raspi OS. | The SD-Card has been flashed with an Ubuntu 20.10 arm64-raspi OS. | ||
Line 24: | Line 26: | ||
* user name: pi | * user name: pi | ||
* password: farmrobot | * password: farmrobot | ||
+ | |||
Its connectable via ethernet or build in wifi module. | Its connectable via ethernet or build in wifi module. | ||
Line 33: | Line 36: | ||
'' | '' | ||
+ | |||
+ | ==== Setup ==== | ||
+ | |||
+ | sudo apt install v4l-utils | ||
+ | sudo apt install ffmpeg | ||
+ | sudo apt install openssh-server sudo ufw allow ssh ssh pi@farmrobot | ||
+ | | ||
+ | === ffmpeg stream === | ||
+ | Bash script '' | ||
+ | ffmpeg -f v4l2 -input_format h264 -video_size 852x480 -framerate 5 -i / | ||
+ | -c:v h264 -preset veryfast -b:v 500k -maxrate 500k -bufsize 10k \ | ||
+ | -pix_fmt yuv420p -g 10 \ | ||
+ | -f flv " | ||
+ | |||
+ | |||
+ | ==== Optional v4l2m2m encoder on arm 64 bit OS ==== | ||
Using v4l2m2m encoder to have arm64 hardware support to efficiently encode a efficient h.265 stream which is sent via rtmp to a server which reencodes to hls to view video stream in a browser. | Using v4l2m2m encoder to have arm64 hardware support to efficiently encode a efficient h.265 stream which is sent via rtmp to a server which reencodes to hls to view video stream in a browser. | ||
- | ffmpeg | + | Building |
- | '' | + | '' |
(installing to / | (installing to / | ||
Line 44: | Line 63: | ||
According to [[https:// | According to [[https:// | ||
- | '' | + | |
autoconf \ | autoconf \ | ||
automake \ | automake \ | ||
Line 68: | Line 87: | ||
yasm \ | yasm \ | ||
zlib1g-dev \ | zlib1g-dev \ | ||
- | libunistring-dev'' | + | libunistring-dev |
+ | |||
+ | installing libaries, chosing wich are needed: | ||
+ | |||
+ | NASM (An assembler used by some libraries.) | ||
+ | |||
+ | cd ~/ | ||
+ | wget https:// | ||
+ | tar xjvf nasm-2.15.05.tar.bz2 && | ||
+ | cd nasm-2.15.05 && | ||
+ | ./ | ||
+ | PATH=" | ||
+ | make -j 4 && | ||
+ | make install | ||
+ | |||
+ | libx264 (H.264 video encoder, fallback) | ||
+ | |||
+ | cd ~/ | ||
+ | git -C x264 pull 2> /dev/null || git clone --depth 1 https:// | ||
+ | cd x264 && | ||
+ | PATH=" | ||
+ | PATH=" | ||
+ | make install | ||
+ | |||
+ | libx265 (H.265/HEVC video encoder) | ||
+ | |||
+ | sudo apt-get install libnuma-dev && | ||
+ | cd ~/ | ||
+ | git -C x265_git pull 2> /dev/null || git clone https:// | ||
+ | cd x265_git/ | ||
+ | PATH=" | ||
+ | PATH=" | ||
+ | make install | ||
+ | |||
+ | libvpx (VP8/VP9 video encoder/ | ||
+ | |||
+ | cd ~/ | ||
+ | git -C libvpx pull 2> /dev/null || git clone --depth 1 https:// | ||
+ | cd libvpx && | ||
+ | PATH=" | ||
+ | PATH=" | ||
+ | make install | ||
+ | |||
+ | libaom (AV1 video encoder/ | ||
+ | |||
+ | cd ~/ | ||
+ | git -C aom pull 2> /dev/null || git clone --depth 1 https:// | ||
+ | mkdir -p aom_build && | ||
+ | cd aom_build && | ||
+ | PATH=" | ||
+ | PATH=" | ||
+ | make install | ||
+ | |||
+ | libsvtav (AV1 video encoder/ | ||
+ | |||
+ | cd ~/ | ||
+ | git -C SVT-AV1 pull 2> /dev/null || git clone https:// | ||
+ | mkdir -p SVT-AV1/ | ||
+ | cd SVT-AV1/ | ||
+ | PATH=" | ||
+ | PATH=" | ||
+ | make install | ||
+ | |||
+ | libdav1d (AV1 decoder, much faster than the one provided by libaom Users whose distributions don't provide a recent enough version of meson (0.49.0 or newer) will need to install a more up-to-date version. This is easily done via the Python Package Index: | ||
+ | ''sudo apt-get install python3-pip && pip3 install --user meson'' | ||
+ | |||
+ | cd ~/ | ||
+ | git -C dav1d pull 2> /dev/null || git clone --depth 1 https:// | ||
+ | mkdir -p dav1d/build && | ||
+ | cd dav1d/build && | ||
+ | meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix " | ||
+ | ninja && | ||
+ | ninja install | ||
+ | |||
+ | Audio libaries are probably needed for building, especially libfdk_aac for vpx libfdk-aac (AAC audio encoder) | ||
+ | |||
+ | cd ~/ | ||
+ | git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https:// | ||
+ | cd fdk-aac && | ||
+ | autoreconf -fiv && ./configure --prefix=" | ||
+ | make -j 4 && | ||
+ | make install | ||
+ | |||
+ | libmp3lame libopus | ||
+ | |||
+ | Building FFmpeg | ||
+ | |||
+ | cd ~/ | ||
+ | wget -O ffmpeg-snapshot.tar.bz2 https:// | ||
+ | tar xjvf ffmpeg-snapshot.tar.bz2 && | ||
+ | cd ffmpeg && | ||
+ | PATH=" | ||
+ | --prefix=" | ||
+ | --pkg-config-flags=" | ||
+ | --extra-cflags=" | ||
+ | --extra-ldflags=" | ||
+ | --extra-libs=" | ||
+ | --bindir=" | ||
+ | --enable-gpl | ||
+ | --arch=aarch64 | ||
+ | --enable-gnutls | ||
+ | --enable-libaom | ||
+ | --enable-libsvtav1 | ||
+ | --enable-libdav1d | ||
+ | --enable-libvpx | ||
+ | --enable-libx264 | ||
+ | --enable-libx265 | ||
+ | --enable-nonfree && | ||
+ | PATH=" | ||
+ | make install && | ||
+ | hash -r | ||
+ | |||
+ | source ~/ | ||
+ | |||
+ | ===== Authors ===== | ||
+ | * Jonas Geßmann, Environment & Energy, jonas.gessmann@protonmail.com \\ | ||
+ | * Nicolas Wiehe |