├── README.md ├── network └── rtl8812au.sh ├── stream-audio.sh ├── stream-mjpeg.sh └── stream-raw.sh /README.md: -------------------------------------------------------------------------------- 1 | # Wireless Pi Streamer (WIP) 2 | This project provides scripts and all instructions to stream HDMI inputs, USB webcams and audio inputs over the network for use in OBS. 3 | 4 | ## TODO 5 | - Automated + interactive setup script for Pi 6 | - Setup scripts for Windows and macOS 7 | - Ability to stream HDMI and camera audio 8 | - Sync video and audio streams by timestamp 9 | 10 | ## Setup 11 | ### Streaming PC 12 | 1. The streaming PC has to have a unique IP address in the same network as the raspberry pi so that all Pis can stream directly to this IP. 13 | 2. Install gstreamer including all necessary plugins 14 | 15 | ### OBS 16 | For OBS you will need the [obs-gstreamer plugin](https://github.com/fzwoch/obs-gstreamer) to receive all media streams. 17 | 18 | ### Raspberry Pi 19 | 1. Enable SSH 20 | 2. Set up password and wifi for Raspberry Pi 21 | 3. Install gstreamer including all necessary plugins 22 | 4. Setup environment variables for the Exact host and port, Cam ID (which generates hostname and the IP address range 50{CAM_ID}x) 23 | 5. Configure streaming scripts for autostart 24 | 25 | ## Stream Instructions 26 | ### HDMI Input (Screen or Professional Camera) 27 | To stream an HDMI input we are usign a [USB HDMI Capture Stick](https://de.aliexpress.com/item/1005001418537929.html) which make the HDMI input available via a new video and audio input. 28 | 29 | The stream already has a low latency (I read about 200ms) but for an even lower latency it might work to use a [HDMI to CSI-2 bridge](https://de.aliexpress.com/item/4000102166176.html) with the [instruction for the Pi Camera](#pi-camera) or to use another and more expensive streaming card which has lower latency. 30 | 31 | The latency for the mentioned streaming stick can be reduced by changing the resolution to 720p instead 1080p. 32 | 33 | #### Raspberry Pi: 34 | 35 | ```bash 36 | ./stream-mjpeg.sh 37 | ``` 38 | 39 | #### OBS GStreamer Source 40 | 41 | ```bash 42 | udpsrc port=5010 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! video. 43 | ``` 44 | 45 | ### USB Webcam 46 | A USB webcam like the Logitech C922 makes the video input available using an x-raw video stream. For this you need another script than for the HDMI input. 47 | 48 | #### Raspberry Pi: 49 | 50 | ```bash 51 | ./stream-raw.sh 52 | ``` 53 | 54 | #### OBS GStreamer Source 55 | 56 | ```bash 57 | udpsrc port=5010 ! gdpdepay ! rtpvrawdepay ! videoconvert ! video. 58 | ``` 59 | 60 | ### Pi Camera 61 | For the Pi Camera there already is [another project](https://github.com/hotsparklab/raspberry-pi-udp-camera) which provides a script including instructions for OBS. 62 | 63 | ### Audio Input (WIP) 64 | To stream an audio input we are usign a [USB audio card](https://de.aliexpress.com/item/32721660686.html) which is natively supported by Raspberry Pi OS. 65 | 66 | #### Raspberry Pi: 67 | 68 | ```bash 69 | ./stream-audio.sh 70 | ``` 71 | 72 | #### OBS GStreamer Source 73 | 74 | ```bash 75 | udpsrc port=5011 caps="application/x-rtp" ! rtppcmadepay ! alawdec ! audio. 76 | ``` 77 | or 78 | ```bash 79 | udpsrc port=5011 ! "application/x-rtp,media=(string)audio, clock-rate=(int)48000, channels=1, payload=(int)96" ! rtpjitterbuffer latency=35 ! rtpL24depay ! audioconvert ! jackaudiosink buffer-time=35000 80 | ``` 81 | 82 | ## Port overview 83 | 84 | The `x` in the port stands for the specific Raspberry Pi. Each Pi should get an unique ID to avoid port collisions. 85 | 86 | - 50x0 - video 87 | - 50x1 - audio -------------------------------------------------------------------------------- /network/rtl8812au.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git clone https://github.com/aircrack-ng/rtl8812au.git 4 | cd rtl8812au || exit 5 | 6 | sudo apt-get install raspberrypi-kernel-headers 7 | 8 | CPUINFO=$(cat /proc/cpuinfo) 9 | 10 | if echo "$CPUINFO" | grep -q "3 Model B+" || echo "$CPUINFO" | grep -q "4 Model B"; then 11 | # for RPI 3B+ & 4B 12 | sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile 13 | sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile 14 | else 15 | # For RPI 1/2/3/ & 0/Zero 16 | sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile 17 | sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile 18 | fi 19 | 20 | make && make install 21 | 22 | cd .. 23 | -------------------------------------------------------------------------------- /stream-audio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gst-launch-1.0 alsasrc device=hw:2 ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=192.168.0.34 port=5011 4 | # gst-launch-1.0 -v alsasrc device=hw:1 provide-clock=true do-timestamp=true ! audio/x-raw,channels=1,depth=24,width=24,rate=48000,payload=96 ! audioconvert ! rtpL24pay ! udpsink host=192.168.0.34 port=5011 5 | # gst-launch-1.0 alsasrc device=hw:0,0 ! audio/x-raw,channels=2,depth=24,width=24,rate=48000 ! audioconvert ! rtpL24pay ! udpsink host=192.168.0.34 port=5011 6 | -------------------------------------------------------------------------------- /stream-mjpeg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,pixel-aspect-ratio=1/1,framerate=30/1 ! rtpjpegpay ! udpsink host=192.168.0.34 port=5010 4 | -------------------------------------------------------------------------------- /stream-raw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=640,height=360 ! videoconvert ! rtpvrawpay ! gdppay ! udpsink host=192.168.0.34 port=5010 4 | --------------------------------------------------------------------------------