From a3978e1e8ecfd7f14d2e90ea4432a03a5e67e313 Mon Sep 17 00:00:00 2001 From: JohnDGodwin <35317840+JohnDGodwin@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:33:47 -0500 Subject: [PATCH 1/4] Update fpv-orange-pi-5-groundstation.md added instructions on displaying the video borderless as well as automatic transcoding of the mkv DVR to hevc mp4 --- fpv-orange-pi-5-groundstation.md | 149 ++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 3 deletions(-) diff --git a/fpv-orange-pi-5-groundstation.md b/fpv-orange-pi-5-groundstation.md index 3ab6dbe..1de608b 100644 --- a/fpv-orange-pi-5-groundstation.md +++ b/fpv-orange-pi-5-groundstation.md @@ -6,7 +6,15 @@ Download Ubuntu Server ISO and flash to device -- https://github.com/Joshua-Rie Go ahead and pull some packages we will need, too. -`sudo apt install dkms python3-all-dev fakeroot network-manager` +`sudo apt install dkms python3-all-dev fakeroot network-manager cmake meson` + +Set system local timezone - replace region and city with your usecase + +`ln -sf /usr/share/zoneinfo// /etc/localtime` + +set hostname + +`sudo nano /etc/hostname` *** @@ -277,6 +285,19 @@ add: sudo /home/ubuntu/dvr.sh & +To display the video stream to the screen borderless we do the following. + +`sudo nano /etc/xdg/openbox/rc.xml` + +locate the line `yes` and replace it with `no` + +then at the end of the file add: + + + + no + + *** @@ -318,6 +339,128 @@ restart nginx to initate the changes `sudo systemctl restart nginx` - - Your DVR is now available for download at x.x.x.x:8080 in a browser + +*** + +Automatic transcoding of the mkv DVR to hevc mp4 + +If you wish to make an apple pie from scratch, you must first invent the universe -- Our gstreamer packages don't handle muxing of mp4 h265 video, and our apt-get ffmpeg package does not include rkmpp hardware acceleration.... so we're going to build ffmpeg with mpp support with the help of https://github.com/nyanmisaka/ffmpeg-rockchip + +We can do this with 3 simple installation scripts. + +First we build MPP from sources, as our current MPP package is older. + +Second we build RGA from sources for the same reason. + +Third we build ffmpeg with rkmpp and rkrga support. + +`sudo nano buildMPP.sh` + + mkdir -p ~/MPP && cd ~/MPP + git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git rkmpp + pushd rkmpp + mkdir rkmpp_build + pushd rkmpp_build + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_TEST=OFF \ + .. + make -j $(nproc) + sudo make install + + +`sudo nano buildRGA.sh` + + mkdir -p ~/RGA && cd ~/RGA + git clone -b jellyfin-rga --depth=1 https://github.com/nyanmisaka/rk-mirrors.git rkrga + meson setup rkrga rkrga_build \ + --prefix=/usr \ + --libdir=lib \ + --buildtype=release \ + --default-library=shared \ + -Dcpp_args=-fpermissive \ + -Dlibdrm=false \ + -Dlibrga_demo=false + meson configure rkrga_build + sudo ninja -C rkrga_build install + +`sudo nano buildFFMPEG.sh` + + mkdir -p ~/ffmpeg && cd ~/ffmpeg + git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git ffmpeg + cd ffmpeg + ./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga + make -j $(nproc) + + ./ffmpeg -decoders | grep rkmpp + ./ffmpeg -encoders | grep rkmpp + ./ffmpeg -filters | grep rkrga + + sudo make install + + +Make the scripts executable + +`sudo chmod +x buildMPP.sh buildRGA.sh buildFFMPEG.sh` + +And run them one at a time: + +`./buildMPP.sh` + +`./buildRGA.sh` + +`./buildFFMPEG.sh` + +Now we can use ffmpeg to hardware transcode the mkv video files to hevc mp4. We can have this automatically happen at the end of each recording by augmenting the dvr.sh script. Open the dvr.sh script in your /home/ubuntu directory, find the line `kill $RUNNING` and add the following two lines below it. + + sleep 0.2 + ffmpeg -hwaccel rkmpp -i record_${current_date}.mkv -c:v hevc_rkmpp record_${current_date}.mp4 + +The full script should look like this: + + #!/bin/bash + + export DISPLAY=:0 + + xset s off -dpms + + GPIO_PIN=5 + RUNNING=0 + gpio mode $GPIO_PIN up + + cd /home/ubuntu/Videos + + while true; do + if [ $(gpio read $GPIO_PIN) -eq 0 ]; then + if [ $RUNNING -eq 0 ]; then + current_date=$(date +'%m-%d-%Y_%H-%M-%S') + + gst-launch-1.0 -e \ + udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265' ! \ + rtph265depay ! \ + h265parse ! \ + tee name=t ! \ + queue ! \ + mppvideodec ! \ + videoconvert ! \ + autovideosink sync=false t. ! \ + queue ! \ + matroskamux ! \ + filesink location=record_${current_date}.mkv & + + RUNNING=$! + else + kill $RUNNING + RUNNING=0 + sleep 0.2 + ffmpeg -hwaccel rkmpp -i record_${current_date}.mkv -c:v hevc_rkmpp record_${current_date}.mp4 + fi + sleep 0.2 + fi + sleep 0.1 + done + + *** From 1c7147179e01b23456216c4d0e002e52586c21c3 Mon Sep 17 00:00:00 2001 From: JohnDGodwin <35317840+JohnDGodwin@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:41:55 -0500 Subject: [PATCH 2/4] Rename fpv-orange-pi-5-groundstation.md to en/fpv-orange-pi-5-groundstation.md --- .../fpv-orange-pi-5-groundstation.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename fpv-orange-pi-5-groundstation.md => en/fpv-orange-pi-5-groundstation.md (100%) diff --git a/fpv-orange-pi-5-groundstation.md b/en/fpv-orange-pi-5-groundstation.md similarity index 100% rename from fpv-orange-pi-5-groundstation.md rename to en/fpv-orange-pi-5-groundstation.md From 7a9c2c5da035a63d1a0c2ec884745c54714f09f2 Mon Sep 17 00:00:00 2001 From: JohnDGodwin <35317840+JohnDGodwin@users.noreply.github.com> Date: Tue, 13 Feb 2024 09:47:59 -0500 Subject: [PATCH 3/4] Update README.md added orange pi 5 vrx fpv listing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0673666..3f03cdd 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ OpenIPC Wiki - [Sigmastar FPV devices](en/fpv-sigmastar.md) - [Ubuntu based groundstation](en/fpv-gs-ubuntu.md) - [OrangePI 5 Ubuntu based groundstation](en/fpv-ground-orange_pi5.md) +- [An Orange Pi 5 minimal VRX for Goggles](en/fpv-orange-pi-5-groundstation.md) - [A selection of OpenIPC videos on YouTube](en/fpv-youtube.md) ### Troubleshooting From c384a7eecee1e8880cd2b0782b9de7c488b20deb Mon Sep 17 00:00:00 2001 From: JohhnGoblin <35317840+JohnDGodwin@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:55:02 -0500 Subject: [PATCH 4/4] Update fpv-orange-pi-5-groundstation.md --- en/fpv-orange-pi-5-groundstation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/fpv-orange-pi-5-groundstation.md b/en/fpv-orange-pi-5-groundstation.md index 1de608b..c77c351 100644 --- a/en/fpv-orange-pi-5-groundstation.md +++ b/en/fpv-orange-pi-5-groundstation.md @@ -6,7 +6,7 @@ Download Ubuntu Server ISO and flash to device -- https://github.com/Joshua-Rie Go ahead and pull some packages we will need, too. -`sudo apt install dkms python3-all-dev fakeroot network-manager cmake meson` +`sudo apt install --no-install-recommends dkms python3-all-dev fakeroot network-manager cmake meson` Set system local timezone - replace region and city with your usecase @@ -24,7 +24,7 @@ Gsteamer setup with MPP Download and install gstreamer -`sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5` +`sudo apt --no-install-recommends install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5`