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..08f5653c --- /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 raw