Thicket data repository for the EEG
at main 2.8 kB view raw
1{ 2 "id": "https://www.tunbury.org/2020/08/29/raspberry-pi-as-rtsp-source-for-obs-using-vlc", 3 "title": "Raspberry PI as RTSP source for OBS using VLC", 4 "link": "https://www.tunbury.org/2020/08/29/raspberry-pi-as-rtsp-source-for-obs-using-vlc/", 5 "updated": "2020-08-29T12:41:29", 6 "published": "2020-08-29T12:41:29", 7 "summary": "Using the new Raspberry Pi Imager I’ve installed the latest Raspberry Pi OS Lite (32 bit).", 8 "content": "<p>Using the new <a href=\"https://www.raspberrypi.org/downloads/\">Raspberry Pi Imager</a> I’ve installed the latest Raspberry Pi OS Lite (32 bit).</p>\n\n<p>Enable ssh by creating a zero length file called ssh on the boot volume</p>\n\n<div><div><pre><code>touch /Volumes/boot/ssh\n</code></pre></div></div>\n\n<p>Create a file <code>/Volumes/boot/wpa_supplicant.conf</code> using your favourite text editor:</p>\n\n<div><div><pre><code>ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\ncountry=GB\n\nnetwork={\n ssid=\"your SSID\"\n psk=\"xxxxxxxx\"\n key_mgmt=WPA-PSK\n}\n</code></pre></div></div>\n\n<p>Boot the Pi and enable the camera module using <code>raspi-config</code>. You need to reboot before the camera is activated.</p>\n\n<p>Sign in as root and run <code>sudo -Es</code> to get an elevated prompt. Update the the base software to the latest version then install <code>vlc</code>. This step will take a while…</p>\n\n<div><div><pre><code>apt install vlc\n</code></pre></div></div>\n\n<p>Create a script containing this command line</p>\n\n<div><div><pre><code>#!/bin/bash\nraspivid -o - -t 0 -rot 180 -w 1920 -h 1080 -fps 30 -b 2000000 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream}' :demux=h264\n</code></pre></div></div>\n\n<p>Test the stream by connecting to ip:8554 using vlc player on the desktop</p>\n\n<div><div><pre><code>rtsp://192.168.1.137:8554/stream\n</code></pre></div></div>\n\n<p>Automate the startup process by creating a service wrapper in <code>/etc/systemd/system/rtsp-stream.service</code> containing the following:</p>\n\n<div><div><pre><code>[Unit]\nDescription=auto start stream\nAfter=multi-user.target\n\n[Service]\nType=simple\nExecStart=/home/pi/rtsp-stream.sh\nUser=pi\nWorkingDirectory=/home/pi\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n</code></pre></div></div>\n\n<p>Enable the service and then reboot</p>\n\n<div><div><pre><code>systemctl enable rtsp-stream.service\n</code></pre></div></div>\n\n<p>In Open Broadcast Studio (OBS) create a new Media Source and untick the check box for Local File and enter the RTSP URL in the input box.</p>", 9 "content_type": "html", 10 "author": { 11 "name": "Mark Elvers", 12 "email": "mark.elvers@tunbury.org", 13 "uri": null 14 }, 15 "categories": [ 16 "obs", 17 "raspberrypi" 18 ], 19 "source": "https://www.tunbury.org/atom.xml" 20}