From 47d27e6d3e2e0519cf28d7583d709d8d52b8b8bd Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Wed, 20 Jun 2018 16:12:53 +0530 Subject: [PATCH 1/2] Added git submodule for adaptive-streaming and some setup scripts --- .gitignore | 1 + .gitmodules | 3 +++ Common/Ubuntu/adaptitve-streaming | 1 + RPI2/Raspbian/9_setup_adaptive_streaming.sh | 25 ++++++++++++++++++++ RPI2/Raspbian/start_adaptive_stream | 26 +++++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 .gitmodules create mode 160000 Common/Ubuntu/adaptitve-streaming create mode 100644 RPI2/Raspbian/9_setup_adaptive_streaming.sh create mode 100644 RPI2/Raspbian/start_adaptive_stream diff --git a/.gitignore b/.gitignore index a3960f51..82c805bd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Intel_Edison/Debian/.vagrant Nvidia_JTX1/Ubuntu/jetpack_download Nvidia_JTX1/Ubuntu/JetPack-L4T-2.3.1-linux-x64.run Nvidia_JTX1/Ubuntu/.vagrant +Common/Ubuntu/adaptive-streaming diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..88e9a737 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Common/Ubuntu/adaptitve-streaming"] + path = Common/Ubuntu/adaptitve-streaming + url = https://github.com/shortstheory/adaptive-streaming diff --git a/Common/Ubuntu/adaptitve-streaming b/Common/Ubuntu/adaptitve-streaming new file mode 160000 index 00000000..28e573dd --- /dev/null +++ b/Common/Ubuntu/adaptitve-streaming @@ -0,0 +1 @@ +Subproject commit 28e573dd645ac5235dbd96c3d11d8ac4bf79d869 diff --git a/RPI2/Raspbian/9_setup_adaptive_streaming.sh b/RPI2/Raspbian/9_setup_adaptive_streaming.sh new file mode 100644 index 00000000..a29fef7a --- /dev/null +++ b/RPI2/Raspbian/9_setup_adaptive_streaming.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# RPi2 setup script for use as companion computer + +if [ $(id -u) -ne 0 ]; then + echo >&2 "Must be run as root" + exit 1 +fi + +set -e +set -x + +#GStreamer deps +apt install libgstreamer-plugins-base1.0* libgstreamer1.0-dev libgstrtspserver-1.0-dev + +#For building +pip3 install meson +apt install ninja-build + +cd +git submodule foreach --recursive git pull +cd Common/Ubuntu/adaptive-streaming/ +meson build +cd build +ninja install diff --git a/RPI2/Raspbian/start_adaptive_stream b/RPI2/Raspbian/start_adaptive_stream new file mode 100644 index 00000000..4a4e634e --- /dev/null +++ b/RPI2/Raspbian/start_adaptive_stream @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e +set -x + +function fail() { + echo "Fail: $*" + exit 1 +} + +STREAM_TO_IP=$1 +if test -z "$STREAM_TO_IP"; then + fail "Need an IP to stream to" +fi +shift + + +# Load the RPi Camera V4L2 Driver +sudo modprobe bcm2835-v4l2 + +# For getting a stream which automatically adjusts the quality according to the +# connection quality. Use the following gst-launch command to make it work: +# gst-launch-1.0 -v rtpbin latency=0 name=rtpbin udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=96" port=5000 ! rtpbin.recv_rtp_sink_0 rtpbin. ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0 ! udpsink port=5001 sync=false async=false host=10.0.1.128 +# By default, port 5000 is used for RTP and port 5001 is used for RTCP + +adaptive_streaming /dev/video0 $STREAM_TO_IP \ No newline at end of file From 2125fbf0b65eef6152392dbb73f65b621c79030c Mon Sep 17 00:00:00 2001 From: arnav dhamija Date: Mon, 25 Jun 2018 17:53:04 +0530 Subject: [PATCH 2/2] Update start_adaptive_stream --- RPI2/Raspbian/start_adaptive_stream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RPI2/Raspbian/start_adaptive_stream b/RPI2/Raspbian/start_adaptive_stream index 4a4e634e..08f5653c 100644 --- a/RPI2/Raspbian/start_adaptive_stream +++ b/RPI2/Raspbian/start_adaptive_stream @@ -23,4 +23,4 @@ sudo modprobe bcm2835-v4l2 # gst-launch-1.0 -v rtpbin latency=0 name=rtpbin udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=96" port=5000 ! rtpbin.recv_rtp_sink_0 rtpbin. ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0 ! udpsink port=5001 sync=false async=false host=10.0.1.128 # By default, port 5000 is used for RTP and port 5001 is used for RTCP -adaptive_streaming /dev/video0 $STREAM_TO_IP \ No newline at end of file +adaptive_streaming /dev/video0 $STREAM_TO_IP raw