Difference between revisions of "SLP (StereoPi Livestream Playground) Raspbian Image"

From StereoPi Wiki
Jump to navigation Jump to search
m (SLP Admin panel options)
m (Updating software)
(45 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
[[File:Slp-admin-panel.png|none|600px|SLP Administration panel]]
 
[[File:Slp-admin-panel.png|none|600px|SLP Administration panel]]
  
This SLP (StereoPi Livestream Playground) image was used for all livestream experiments mentioned on our crowdfunding page https://www.crowdsupply.com/virt2real/stereopi  
+
<br>
 +
This SLP (StereoPi Livestream Playground) image was used for all livestream experiments mentioned on our crowdfunding page  
 +
 
 +
https://www.crowdsupply.com/virt2real/stereopi  
  
 
and has some additional features. It is not comfortable to use with a monitor, keyboard and mouse. We do it in consumer-like way to save  time. It has an Administration panel (like WiFi routers), and is also accessible via SSH.
 
and has some additional features. It is not comfortable to use with a monitor, keyboard and mouse. We do it in consumer-like way to save  time. It has an Administration panel (like WiFi routers), and is also accessible via SSH.
Line 12: Line 15:
 
And last notice: by default single-camera mode is enabled for classic Raspberry Pi.
 
And last notice: by default single-camera mode is enabled for classic Raspberry Pi.
  
Please remember it is Beta only. If you find some bugs, do not be angry. Please let us know here on Raspberry Pi forum:
+
Please remember it is Beta only. If you find some bugs, do not be angry. Please let us know here on our forum:
  https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=216940
+
  http://forum.stereopi.com
 
<br>
 
<br>
  
Line 26: Line 29:
 
== How to prepare MicroSD card with SLP ==
 
== How to prepare MicroSD card with SLP ==
 
# Prepare MicroSD card 16 Gb or higher capacity.
 
# Prepare MicroSD card 16 Gb or higher capacity.
# Download image file and unzip it on your computer. '''File size is about 5 Gb.'''
+
# Download image file and unzip it on your computer. '''File size is about 850 Mb.'''
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://wiki.stereopi.com/files/slp-raspbian-190205.zip Download mirror 1] (Our Wiki hosting)
+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://wiki.stereopi.com/files/slp-raspbian-190301.img.zip Download mirror 1] (Our Wiki hosting)
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[https://drive.google.com/file/d/1JnxccWD9Vjz0Yjj16mewli41-grd7M2Z/view?usp=sharing Download mirror 2] (Google Drive)
+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[https://drive.google.com/open?id=1skQFHnB-fUtY8vWWXTv2MmjwUGjEFF_i Download mirror 2] (Google Drive)
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[https://yadi.sk/d/utvXWrhQ-Q5IrA Download mirror 3] (Yandex Disk)
+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[https://disk.yandex.ru/d/tYN6djzFgJ29Nw Download mirror 3] (Yandex Disk)
  
 
# Write image to MicroSD. As a Pi user, you might know, that it does not mean “copy-paste” image file, but requires special image writing software. In Windows we prefer to use [https://sourceforge.net/projects/win32diskimager/ Win32DiskImager].
 
# Write image to MicroSD. As a Pi user, you might know, that it does not mean “copy-paste” image file, but requires special image writing software. In Windows we prefer to use [https://sourceforge.net/projects/win32diskimager/ Win32DiskImager].
Line 51: Line 54:
 
  wifi_ssid=my-access-point-name
 
  wifi_ssid=my-access-point-name
 
  wifi_psk=mypassword
 
  wifi_psk=mypassword
 +
 +
If you use StereoPi with WiFi dongle, find this row:
 +
 +
wifi_iface =
 +
 +
and add "wlan0" at the end, so you should see:
 +
 +
wifi_iface = wlan0
 +
 +
Please '''do not forget to connect WiFi dongle''' to your device before powering on.
 +
 +
If you use classic Raspberry Pi with built in WiFi, use this option:
 +
 +
wifi_iface = wifi0
 +
 +
By default we rename built-in Raspberry Pi WiFi to "wifi0" interface with udev rule to use several wireless interfaces.
  
  
If you use Raspberry Pi WITHOUT built-in WiFi or StereoPi, please do not forget to connect WiFi dongle to your device before powering on.
 
 
Now your Pi will automatically connect to your router after booting. If it is does not work – please check twice AP name and password. Also system might not like SSID name with spaces in it.
 
Now your Pi will automatically connect to your router after booting. If it is does not work – please check twice AP name and password. Also system might not like SSID name with spaces in it.
 +
 +
=== One more tip ===
 +
 +
Until you removed your MicroSD, you can also turn on stereoscopic mode instead of single-camera mode right here, in configuration file.
 +
 +
Find this row:
 +
 +
video_mode=2D
 +
 +
and change 2D to 3D:
 +
 +
video_mode=3D
  
 
=== Trick ===
 
=== Trick ===
 
If you enable WiFi access point on your phone, Pi will access Internet over it. That is, you can both livestream to YouTube and access Admin panel. So you can livestream to YouTube using your phone and powerbank to power on your Pi.
 
If you enable WiFi access point on your phone, Pi will access Internet over it. That is, you can both livestream to YouTube and access Admin panel. So you can livestream to YouTube using your phone and powerbank to power on your Pi.
  
 +
=== 4G/LTE Dongle ===
 +
If you connect 4G/LTE dongle with RNDIS support, your Pi will livestream to the Internet. In our aquarium experiment we used Huawei E3372 dongle.
 +
<br>
 
<br>
 
<br>
 +
 +
== All configuration file options ==
 +
 +
File stereopi.conf includes a lot of options. If you are not sure, please do not change these options. Use administration panel instead.
 +
 +
video_width=1280
 +
video_mode=3D
 +
video_height=720
 +
video_fps=30
 +
video_bitrate=3000000
 +
video_profile=baseline
 +
rtmp_url=
 +
rtmp_enabled=0
 +
mpegts_clients=192.168.1.10:3001
 +
mpegts_enabled=0
 +
rtsp_enabled=0
 +
usb_enabled=1
 +
audio_enabled=0
 +
video_wb=auto
 +
exposure=auto
 +
contrast=-15
 +
sharpness=0
 +
digitalgain=0.0
 +
wifi_iface=wlan0
 +
wifi_ssid=WIFI-NAME
 +
wifi_psk=WIFI-PASSWORD
 +
record_enabled=1
 +
record_time=30
 +
dec_enabled=0
 +
up_down=0
 +
udp_clients=192.168.1.10:3000
 +
udp_enabled=0
 +
ws_enabled=1
  
 
== How do you find StereoPi in your network? ==  
 
== How do you find StereoPi in your network? ==  
Line 65: Line 131:
  
 
=== Connecting to SLP with auto-discovery feature ===
 
=== Connecting to SLP with auto-discovery feature ===
 +
 
We suggest your Pi and computer/phone/tablet are connected to the same router, and your network has no difficult topology.
 
We suggest your Pi and computer/phone/tablet are connected to the same router, and your network has no difficult topology.
  
 +
<br>
 
1. Open a browser and type:
 
1. Open a browser and type:
  
 
http://stereopi.local
 
http://stereopi.local
 +
 +
Important: '''This method works on MacOS, iOS and Windows 10 only!'''
  
 
Admin panel will appear. In some networks it works immediately, but in other networks it might take some time to find and open panel (10-20 seconds). You will see Administration panel:
 
Admin panel will appear. In some networks it works immediately, but in other networks it might take some time to find and open panel (10-20 seconds). You will see Administration panel:
  
 
[[File:Slp-admin-panel.png|none|300px|SLP administration panel]]
 
[[File:Slp-admin-panel.png|none|300px|SLP administration panel]]
 +
 
<br>
 
<br>
 
2. Open our Android application. It will automatically find your Pi, connect to it and start playing livestream video. If you tap on the screen you will see a prompt with an IP address. If you tap on it, then browser will be opened with Admin panel.
 
2. Open our Android application. It will automatically find your Pi, connect to it and start playing livestream video. If you tap on the screen you will see a prompt with an IP address. If you tap on it, then browser will be opened with Admin panel.
  
 
[[File:Stereopi-android-application.jpg|none|300px|StereoPi Android Application Screenshot]]
 
[[File:Stereopi-android-application.jpg|none|300px|StereoPi Android Application Screenshot]]
 +
 +
<br>
  
 
=== Connecting to SLP with other methods ===
 
=== Connecting to SLP with other methods ===
Line 93: Line 166:
  
 
== Android application ==
 
== Android application ==
 +
Notice: for Oculus Go please read next paragraph [[SLP (StereoPi Livestream Playground) Raspbian Image#Oculus Go application|Oculus Go application]]
  
 
This simple application automatically connects to Pi with SLP image, requests video livestream and shows it.  
 
This simple application automatically connects to Pi with SLP image, requests video livestream and shows it.  
 
[[File:Stereopi-android-application.jpg|none|300px|StereoPi Android Application Screenshot]]
 
[[File:Stereopi-android-application.jpg|none|300px|StereoPi Android Application Screenshot]]
 +
 +
<br>
 
If you use StereoPi and “3D” mode enabled in Admin panel – you can enjoy 3D video by putting your phone to google cardboard-like device. We like [https://www.geeektech.com/en/geeek-color-cross-vr-3d-glasses-for-smartphones.html ColorCross] and [https://www.gearbrain.com/i-am-cardboard-vr-headset-2349974389.html Pocket 360] solutions.
 
If you use StereoPi and “3D” mode enabled in Admin panel – you can enjoy 3D video by putting your phone to google cardboard-like device. We like [https://www.geeektech.com/en/geeek-color-cross-vr-3d-glasses-for-smartphones.html ColorCross] and [https://www.gearbrain.com/i-am-cardboard-vr-headset-2349974389.html Pocket 360] solutions.
  
Line 101: Line 177:
  
  
 +
<br>
 
If you use classic Pi, you can see video livestream from your camera without any additional equipment.
 
If you use classic Pi, you can see video livestream from your camera without any additional equipment.
  
Line 109: Line 186:
 
You can also use this application on Oculus Go as we did. Put your Oculus Go in developer mode and upload application. At this moment there are no joystick support for Oculus, and we plan to add it later.
 
You can also use this application on Oculus Go as we did. Put your Oculus Go in developer mode and upload application. At this moment there are no joystick support for Oculus, and we plan to add it later.
  
 +
<br>
 
=== Android Application Compatibility ===
 
=== Android Application Compatibility ===
Application was tested on Android 7.1.1, 7.1.2 and 8.0  
+
Application was tested on Android 5.1.1, 6.0, 7.1.2 and 8.0  
 +
 
 +
It is compiled for Androids >=5.0.
  
It is compiled for Androids >=5.0, but was not tested with 5 and 6 versions.
+
<br>
  
 
=== Android Application Performance Notice ===
 
=== Android Application Performance Notice ===
 
With old Android phones (5 years or more) you may obtain high latency of your video (delay up to 0.3-0.5 seconds). With newer models video latency is near 0.1 seconds.
 
With old Android phones (5 years or more) you may obtain high latency of your video (delay up to 0.3-0.5 seconds). With newer models video latency is near 0.1 seconds.
  
 +
<br>
 
=== Download link ===
 
=== Download link ===
[http://wiki.stereopi.com/files/StereoPi-2019-02-05.apk Download APK file.]
+
[https://play.google.com/store/apps/details?id=com.virt2real.stereopi StereoPi Application, Google Play.]
 +
<br>
 +
 
 +
== Oculus Go application ==
 +
 
 +
[[File:Stereopi-in-unknown-sources.png|none|300px|Stereopi in unknown sources]]
 +
 
 +
For Oculus Go please use special edition of our APK file.
 +
 
 +
[http://wiki.stereopi.com/files/StereoPi-OculusGo.zip StereoPi-OculusGo.zip]
  
<br>
+
In this ZIP file you will find:
 +
* StereoPi.apk file for uploading to Oculus Go
 +
* adb.exe utility for uploading APK to your Oculus
 +
* Readme file
  
 
== HDMI stereoscopic preview (RC FPV usage) ==
 
== HDMI stereoscopic preview (RC FPV usage) ==
Line 169: Line 262:
 
<br>
 
<br>
 
=== RTMP URL (YouTube etc.) ===
 
=== RTMP URL (YouTube etc.) ===
If you put RTMP string here, Pi will send livestream to it.
+
If you put RTMP string here, Pi will send the livestream to it.
 
For livestream to YouTube you need to copy livestream link from your YouTube studio and put it in this field. Our link looks like this:
 
For livestream to YouTube you need to copy livestream link from your YouTube studio and put it in this field. Our link looks like this:
  
Line 175: Line 268:
  
 
==== Trick: ====  
 
==== Trick: ====  
YouTube does not allow livestream without sound. So if SLP has not detected USB soundcard and Microphone, it adds fake silence sound to this stream, and it works. If you have USB soundcard and mic, you will hear sound on YouTube.
+
YouTube does not allow livestream without sound. So if SLP has not detected a USB soundcard and microphone, it adds fake silence sound to this stream, and it works. If you have USB soundcard and mic, you will hear sound on YouTube.
  
 
==== Tip: ====  
 
==== Tip: ====  
If you have no experience on YouTube livestream, you should know that YouTube adds time-buffer up to 30 seconds for your video. That is you will not see your video immediately, and when you see it you can find some delay. It is not a bug, it is a feature. It helps viewers to obtain smooth and high-quality video.
+
If you have no experience on YouTube livestream, you should know that YouTube adds a time buffer of up to 30 seconds for your video. That is, you will not see your video immediately, and when you see it, you can find some delay. It is not a bug, but a feature. It helps viewers to obtain smooth and high-quality video.
  
 
<br>
 
<br>
 +
 
=== Video mode ===
 
=== Video mode ===
 
Choose 3D if you have StereoPi or another Pi-based solution with two cameras connected.
 
Choose 3D if you have StereoPi or another Pi-based solution with two cameras connected.
Line 187: Line 281:
 
<br>
 
<br>
 
=== Decimation ===
 
=== Decimation ===
This option scale each taken image horizontally to 50% of its original width. This feature is useful for FPV and Depth Map, as you save full FOV (field of view) of your camera. For other implementations you may uncheck this option. In this case FOV will be cropped, but you have normal side ratio of your video. For our Oculus experiment we unchecked this option.
+
This option compress each taken image horizontally to 50% of its original width. This feature is useful for FPV and Depth Map, as you save full FOV (field of view) of your camera. For other implementations you may uncheck this option. In this case FOV will be cropped, but you have normal side ratio of your video. For our Oculus experiment we unchecked this option.
 
In fact this option adds “-dec” parameter to raspivid.
 
In fact this option adds “-dec” parameter to raspivid.
  
 
<br>
 
<br>
 +
 
=== Upside/Down ===
 
=== Upside/Down ===
Rotate image on 180 degree. With 1 camera it is simple. With 2 cameras we do flip and also swap left/right images. Otherwise your left and right images appear on a wrong place, and your brain will be stuck on trying to build 3D image from this.
+
Rotate image to 180 degree. With 1 camera it is simple. With 2 cameras we do flip and also swap left/right images. Otherwise your left and right images appear in the wrong place, and your brain will be stuck on trying to build 3D image from this.
  
 
<br>
 
<br>
 +
 
=== Video resolution ===
 
=== Video resolution ===
 
Resolution of video captured.
 
Resolution of video captured.
Line 201: Line 297:
 
=== FPS ===
 
=== FPS ===
 
Frames Per Second settings for video. Please notice, that if you choose too high FPS for high resolution you may obtain capture problems.
 
Frames Per Second settings for video. Please notice, that if you choose too high FPS for high resolution you may obtain capture problems.
For 1280x720 with ONE camera you may use 48 FPS. For 1280x720 and 3D use 42 FPS.
+
For 1280x720 with ONE camera you may use 48 FPS. For 1280x720 and 3D use 42 FPS. You can experiment with these settings to fit your needs.  
You can experiment with these settings to fit your needs. We want to notice that highest FPS is critical for at least two scopes. First one is livestream to VR helmets like Oculus, as perception comfort depend on this. The second one is RC FPV, as higher FPS decrease video latency.
+
 
 +
We want to notice that highest FPS is critical for at least two scopes. First one is livestream to VR helmets like Oculus, as ease of perception depends on this. The second one is RC FPV, as higher FPS decrease video latency.
  
 
<br>
 
<br>
 +
 
=== Bitrate ===
 
=== Bitrate ===
Number of megabits used for 1 second of video after compression, in megabits (not megabytes). This settings affects on H264 encoder of your Pi. The higher bitrate, the better video quality you have, and the more bandwidth connection required for livestream.  
+
Number of megabits used for 1 second of video after compression, in megabits (not megabytes). This settings affects the H264 encoder of your Pi. The higher bitrate, the better video quality you have, and the more bandwidth connection required for livestream.  
 
For livestream we recommend to use 2-3 Mbit at HD or FullHD resolution. For 640x480 even 1 Mbit is Ok. Higher bitrates are useful for recording video on MicroSD without livestream. Please notice you need a high-speed MicroSD to record at high bitrates.  
 
For livestream we recommend to use 2-3 Mbit at HD or FullHD resolution. For 640x480 even 1 Mbit is Ok. Higher bitrates are useful for recording video on MicroSD without livestream. Please notice you need a high-speed MicroSD to record at high bitrates.  
  
 
<br>
 
<br>
 +
 
=== White balance ===
 
=== White balance ===
 
Changes white balance mode.
 
Changes white balance mode.
Line 231: Line 330:
 
Changes sharpness mode.
 
Changes sharpness mode.
  
'''Notice:''' looks like this feature implementation have a bug in Raspbian, as it is work to only one camera in stereoscopic mode.  
+
'''Notice:''' It looks as if this feature has a bug in Raspbian, as it is work with only one camera in stereoscopic mode.  
  
 
In this option we implemented [https://www.raspberrypi.org/documentation/raspbian/applications/camera.md options available for Raspberry Pi Camera].
 
In this option we implemented [https://www.raspberrypi.org/documentation/raspbian/applications/camera.md options available for Raspberry Pi Camera].
  
 
<br>
 
<br>
 +
 
=== Digital gain ===
 
=== Digital gain ===
 
Changes digital gain mode.
 
Changes digital gain mode.
Line 243: Line 343:
 
<br>
 
<br>
 
=== Wifi SSID ===
 
=== Wifi SSID ===
Name of you WiFi access point
+
Name of your WiFi access point
  
 
Can be adjusted here or in <code>stereopi.conf</code> file in a BOOT partition
 
Can be adjusted here or in <code>stereopi.conf</code> file in a BOOT partition
  
 
<br>
 
<br>
 +
 
=== WiFi password ===
 
=== WiFi password ===
 
Password for your WiFi.  
 
Password for your WiFi.  
Line 253: Line 354:
 
<br>
 
<br>
 
=== Updating software ===
 
=== Updating software ===
If we have an update, we create a file named <code>stereopi.tar.gz</code>.
+
If we have an update, we created a file named <code>stereopi.tar.gz</code>.
  
You can put it in “BOOT” part of MicroSD. After start SLP will automatically find it and implement.
+
You can put it in “BOOT” part of MicroSD. After start, SLP will automatically find and implement it.
 +
 
 +
You can also do it more comfort way, using "Upload update" button in our Admin panel.
  
'''Notice:''' we have no released any public updates yet.
 
  
 
<br>
 
<br>
Line 263: Line 365:
 
== Advanced users’ section ==
 
== Advanced users’ section ==
  
 +
<br>
 
=== SSH access ===
 
=== SSH access ===
You might want to look inside. When you know IP address of your Pi you can access it by SSH.  
+
You might want to look inside. When you know the IP address of your Pi, you can access it by SSH.  
 +
 
 +
User credentials:
  
User credentials are the same as for default user:
+
'''login:''' <code>root</code>
  
'''login:''' <code>pi</code>
+
'''password:''' <code>root</code>
  
'''password:''' <code>raspberry</code>
+
<br>
  
 
=== SLP structure details you should know ===
 
=== SLP structure details you should know ===
1. We prepared this image for aggressive usage, that’s why we want to save filesystem in a case of occasional poweroffs. So by default filesystem is read-only and you cannot change any file. To unlock it type:
+
1. We prepared this image for aggressive usage. That’s why we want to save the filesystem in a case of occasional poweroffs. So by default, filesystem is read-only and you cannot change any file. To unlock it type:
  
 
<code>sudo mount -o rw,remount /</code>
 
<code>sudo mount -o rw,remount /</code>
Line 286: Line 391:
  
  
If you're goes in this directory, you can stop all scripts by running:
+
If you will enter this directory, you can stop all scripts by running:
  
 
<code>./stop.sh</code>
 
<code>./stop.sh</code>
Line 294: Line 399:
 
<code>./run.sh</code>
 
<code>./run.sh</code>
  
4. Most scripts have auto-restart feature
+
4. Most scripts have auto-restart feature (start again if something go wrong).
  
5. A few words about “chunker” utility
+
5. A few words about “chunker” utility:
  
We have a lot of projects when we capture video from one source and need to use it in several ways at the same time (like livestream, record and use for Computer Vision). So we need to send it to several applications at the same time. We use network approach with this, and subsystems of our projects talk with each other over network infrastructure with 127.0.0.1 and different ports. This approach gives us flexibility and we can easily forward video stream to internal subsystem or to external IP address. For example, if you decide to move your OpenCV part from Pi to nearby NVidia Jetson, you just aim livestream from internal IP and port to Jetson’s one.
+
We have a lot of projects when we capture video from one source and need to use it in several ways at the same time (like livestream, record and use for Computer Vision). So we need to send it to several applications at the same time. We use a network approach with this, and subsystems of our projects talk with each other over network infrastructure with 127.0.0.1 and different ports. This approach gives us flexibility and we can easily forward video stream to internal subsystem or to external IP address. For example, if you decide to move your OpenCV part from Pi to nearby NVidia Jetson, you just aim livestream from internal IP and port to Jetson’s one.
 
So “in the root” of this system we have special “chunker” utility. It cuts video stream on pieces to fit network bandwidth with maximum efficiency, and try to adapt to maximum MTU available. At this moment this utility is overloaded with a lot of features for our custom projects. We will exclude all unneeded features and open source it after polishing.
 
So “in the root” of this system we have special “chunker” utility. It cuts video stream on pieces to fit network bandwidth with maximum efficiency, and try to adapt to maximum MTU available. At this moment this utility is overloaded with a lot of features for our custom projects. We will exclude all unneeded features and open source it after polishing.
 +
 +
<br>
  
 
=== Receive livestream on Windows ===
 
=== Receive livestream on Windows ===
Line 308: Line 415:
 
<code>gst-launch-1.0 -v udpsrc port=3000 buffer-size=300000 ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false</code>
 
<code>gst-launch-1.0 -v udpsrc port=3000 buffer-size=300000 ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false</code>
  
 +
<br>
 
=== Receive livestream on Mac ===
 
=== Receive livestream on Mac ===
 
To receive it on Mac you may run the same line:
 
To receive it on Mac you may run the same line:
Line 317: Line 425:
 
To obtain livestream I need:
 
To obtain livestream I need:
  
# In Admin panel I turn on "Stream UDP" option
+
# In SLP Admin panel I turn on "Stream UDP" option
 
# Put "192.168.1.139:3000" in UDP clients field
 
# Put "192.168.1.139:3000" in UDP clients field
 
# Press "save" at the bottom of Admin panel
 
# Press "save" at the bottom of Admin panel
# Run gst-launch line in command line
+
# Run gst-launch line in command line on my Mac
  
  
Line 331: Line 439:
  
 
Gstreamer have been installed with Brew package manager.
 
Gstreamer have been installed with Brew package manager.
 +
 +
<br>
  
 
=== Receive livestream on iOS devices ===
 
=== Receive livestream on iOS devices ===
For iOS we used gstreamer-based application Fishing FanCam application, described in [https://github.com/rodizio1/EZ-WifiBroadcast/wiki/GCS-~-FishingFanCam EZ-broadcast Wiki].  
+
For iOS we used gstreamer-based Fishing FanCam application, described in [https://github.com/rodizio1/EZ-WifiBroadcast/wiki/GCS-~-FishingFanCam EZ-broadcast Wiki].  
  
 
But looks like this application is not supported now. We plan to do our own application for this, but it might take a lot of time. We will be pleased If you can suggest other gstreamer-based iOS applications or help us with making simple application like our Android one.
 
But looks like this application is not supported now. We plan to do our own application for this, but it might take a lot of time. We will be pleased If you can suggest other gstreamer-based iOS applications or help us with making simple application like our Android one.

Revision as of 13:04, 17 May 2019

SLP Raspbian Image Specific

SLP Administration panel


This SLP (StereoPi Livestream Playground) image was used for all livestream experiments mentioned on our crowdfunding page

https://www.crowdsupply.com/virt2real/stereopi

and has some additional features. It is not comfortable to use with a monitor, keyboard and mouse. We do it in consumer-like way to save time. It has an Administration panel (like WiFi routers), and is also accessible via SSH.

As this image is compatible with both StereoPi and classic Raspberry Pi, let us use “Pi” name in this article.

And last notice: by default single-camera mode is enabled for classic Raspberry Pi.

Please remember it is Beta only. If you find some bugs, do not be angry. Please let us know here on our forum:

http://forum.stereopi.com


Partition structure

Classic Raspbian has two partitions: BOOT and a Linux filesystem. Our image has both of them (using 4Gb on MicroSD), and also offers 3rd partition in Fat32. It is used for recording captured video. So after recording a video, you can insert MicroSD into your computer and see all your records, as with your car dashcam.

SLP partitions structure


How to prepare MicroSD card with SLP

  1. Prepare MicroSD card 16 Gb or higher capacity.
  2. Download image file and unzip it on your computer. File size is about 850 Mb.

            Download mirror 1 (Our Wiki hosting)

            Download mirror 2 (Google Drive)

            Download mirror 3 (Yandex Disk)

  1. Write image to MicroSD. As a Pi user, you might know, that it does not mean “copy-paste” image file, but requires special image writing software. In Windows we prefer to use Win32DiskImager.
  2. Do not remove MicroSD right after this procedure, as you might want to set up access to your WiFi hot spot. You can do it right after preparing image.

Tip1: Not all MicroSD marked as 16Gb have the exact same size. Win32DiskImager may warn you that your MicroSD is too small, but you have the option to “continue”. For this case we leave several hundreds of unused spaces at the end of MicroSD, so image will not be broken on such cards.

Tip 2 for advanced users: Main system use only 4 Gb on MicroSD, and other ~12 Gb is used for video records. If you have only 8 Gb card, you may record our SLP image too with Win32DiskImager. But after that you need to manually fix broken Fat32 partition (create it again and format).


Network configuration

Ethernet access

If you connect Pi by Ethernet to your router, you do not need to configure it. IP address will be obtained automatically by DHCP.

WiFi access

If you did not removed prepared MicroSD from your computer, you should now go to “BOOT” disk and find “stereopi.conf” file. Open it and write your WiFi access point name and password in these rows:

wifi_ssid=my-access-point-name
wifi_psk=mypassword

If you use StereoPi with WiFi dongle, find this row:

wifi_iface =

and add "wlan0" at the end, so you should see:

wifi_iface = wlan0

Please do not forget to connect WiFi dongle to your device before powering on.

If you use classic Raspberry Pi with built in WiFi, use this option:

wifi_iface = wifi0

By default we rename built-in Raspberry Pi WiFi to "wifi0" interface with udev rule to use several wireless interfaces.


Now your Pi will automatically connect to your router after booting. If it is does not work – please check twice AP name and password. Also system might not like SSID name with spaces in it.

One more tip

Until you removed your MicroSD, you can also turn on stereoscopic mode instead of single-camera mode right here, in configuration file.

Find this row:

video_mode=2D

and change 2D to 3D:

video_mode=3D

Trick

If you enable WiFi access point on your phone, Pi will access Internet over it. That is, you can both livestream to YouTube and access Admin panel. So you can livestream to YouTube using your phone and powerbank to power on your Pi.

4G/LTE Dongle

If you connect 4G/LTE dongle with RNDIS support, your Pi will livestream to the Internet. In our aquarium experiment we used Huawei E3372 dongle.

All configuration file options

File stereopi.conf includes a lot of options. If you are not sure, please do not change these options. Use administration panel instead.

video_width=1280
video_mode=3D
video_height=720
video_fps=30
video_bitrate=3000000
video_profile=baseline
rtmp_url=
rtmp_enabled=0
mpegts_clients=192.168.1.10:3001
mpegts_enabled=0
rtsp_enabled=0
usb_enabled=1
audio_enabled=0
video_wb=auto
exposure=auto
contrast=-15
sharpness=0
digitalgain=0.0
wifi_iface=wlan0
wifi_ssid=WIFI-NAME
wifi_psk=WIFI-PASSWORD
record_enabled=1
record_time=30
dec_enabled=0
up_down=0
udp_clients=192.168.1.10:3000
udp_enabled=0
ws_enabled=1

How do you find StereoPi in your network?

We use auto-discovery feature in our SLP image. So here are some approaches how to connect StereoPi using it.

Connecting to SLP with auto-discovery feature

We suggest your Pi and computer/phone/tablet are connected to the same router, and your network has no difficult topology.


1. Open a browser and type:

http://stereopi.local

Important: This method works on MacOS, iOS and Windows 10 only!

Admin panel will appear. In some networks it works immediately, but in other networks it might take some time to find and open panel (10-20 seconds). You will see Administration panel:

SLP administration panel


2. Open our Android application. It will automatically find your Pi, connect to it and start playing livestream video. If you tap on the screen you will see a prompt with an IP address. If you tap on it, then browser will be opened with Admin panel.

StereoPi Android Application Screenshot


Connecting to SLP with other methods

1. You can use software for network scan to find IP address.

- For Windows you can use Advanced IP Scanner

- For Mac you can use LanScan.

2. You can go to your router Admin panel and look for IP addresses in a list of connected devices.

3. After you’ve found IP address, type it in your browser.


Android application

Notice: for Oculus Go please read next paragraph Oculus Go application

This simple application automatically connects to Pi with SLP image, requests video livestream and shows it.

StereoPi Android Application Screenshot


If you use StereoPi and “3D” mode enabled in Admin panel – you can enjoy 3D video by putting your phone to google cardboard-like device. We like ColorCross and Pocket 360 solutions.

ColorCross and Pocket 360 VR sets



If you use classic Pi, you can see video livestream from your camera without any additional equipment.

Tap on the screen to show prompt with current IP address of Pi.

Clicking on this prompt will open browser with Admin panel.

You can also use this application on Oculus Go as we did. Put your Oculus Go in developer mode and upload application. At this moment there are no joystick support for Oculus, and we plan to add it later.


Android Application Compatibility

Application was tested on Android 5.1.1, 6.0, 7.1.2 and 8.0

It is compiled for Androids >=5.0.


Android Application Performance Notice

With old Android phones (5 years or more) you may obtain high latency of your video (delay up to 0.3-0.5 seconds). With newer models video latency is near 0.1 seconds.


Download link

StereoPi Application, Google Play.

Oculus Go application

Stereopi in unknown sources

For Oculus Go please use special edition of our APK file.

StereoPi-OculusGo.zip

In this ZIP file you will find:

  • StereoPi.apk file for uploading to Oculus Go
  • adb.exe utility for uploading APK to your Oculus
  • Readme file

HDMI stereoscopic preview (RC FPV usage)

Right after start Pi will push image from camera to HDMI output. For 3D view on HDMI we used some trick. By default Raspbian turn HDMI in 3D mode if it needs to show 3D image, for devices like 3D TV. So on a classic monitor you will see an image from one camera and a part of an image from second camera. We have modified raspivid and manually turned HDMI in non-3d mode. So if you’re RC modelist and want to livestream 3D from StereoPi using your FPV link with HDMI capture – just connect StereoPi to it. In the future we will discuss this option with Raspbian support team to find an easier way to trigger this 3D/non-3D HDMI mode.


SLP Admin panel options


Recording

If you turn on this feature, Pi will record all video to MicroSD card.


Max rec duration

Recorded video will be cut on pieces with a chosen length.

Why do you need it? The answer is simple. We capture “raw” h264 stream from a camera. If you record it directly, you will feel some problems while viewing it in your video player. For example, scroll may not work etc. So we need to convert it to MP4 for comfort use. Our SLP does it on-the-go. But to do it correctly our utility needs to add some information to the file. If you turn off your Pi during this process, you may lose your last record, but all previous records remain safe.

What time to choose? For short on-table experiments it is better to set minimal time (30 seconds). For real-life experiments it is better to set 5-10 minutes.


Stream UDP

Section for advanced users. You may put IP addresses and ports of devices you want to livestream to.

You may use several comma-separated values in “UDP clients” field, like this:

192.168.1.10:3000,192.168.1.20:4000

To capture this stream you may use your own application or gstreamer (see Advanced User’s Section).


UDP clients

Field for UDP clients (for Stream UDP option).


Broadcast

Turn on or turn off video livestream.


Audio enabled

If you connect USB sound card with Microphone, or USB microphone, system will try to stream video with sound.


RTMP URL (YouTube etc.)

If you put RTMP string here, Pi will send the livestream to it. For livestream to YouTube you need to copy livestream link from your YouTube studio and put it in this field. Our link looks like this:

rtmp://a.rtmp.youtube.com/live2/9k1d-2ue3-xxxx-xxxx

Trick:

YouTube does not allow livestream without sound. So if SLP has not detected a USB soundcard and microphone, it adds fake silence sound to this stream, and it works. If you have USB soundcard and mic, you will hear sound on YouTube.

Tip:

If you have no experience on YouTube livestream, you should know that YouTube adds a time buffer of up to 30 seconds for your video. That is, you will not see your video immediately, and when you see it, you can find some delay. It is not a bug, but a feature. It helps viewers to obtain smooth and high-quality video.


Video mode

Choose 3D if you have StereoPi or another Pi-based solution with two cameras connected. Choose 2D if you have classic Raspberry Pi. If you use this option with StereoPi, only one camera will be used for video capture.


Decimation

This option compress each taken image horizontally to 50% of its original width. This feature is useful for FPV and Depth Map, as you save full FOV (field of view) of your camera. For other implementations you may uncheck this option. In this case FOV will be cropped, but you have normal side ratio of your video. For our Oculus experiment we unchecked this option. In fact this option adds “-dec” parameter to raspivid.


Upside/Down

Rotate image to 180 degree. With 1 camera it is simple. With 2 cameras we do flip and also swap left/right images. Otherwise your left and right images appear in the wrong place, and your brain will be stuck on trying to build 3D image from this.


Video resolution

Resolution of video captured.


FPS

Frames Per Second settings for video. Please notice, that if you choose too high FPS for high resolution you may obtain capture problems. For 1280x720 with ONE camera you may use 48 FPS. For 1280x720 and 3D use 42 FPS. You can experiment with these settings to fit your needs.

We want to notice that highest FPS is critical for at least two scopes. First one is livestream to VR helmets like Oculus, as ease of perception depends on this. The second one is RC FPV, as higher FPS decrease video latency.


Bitrate

Number of megabits used for 1 second of video after compression, in megabits (not megabytes). This settings affects the H264 encoder of your Pi. The higher bitrate, the better video quality you have, and the more bandwidth connection required for livestream. For livestream we recommend to use 2-3 Mbit at HD or FullHD resolution. For 640x480 even 1 Mbit is Ok. Higher bitrates are useful for recording video on MicroSD without livestream. Please notice you need a high-speed MicroSD to record at high bitrates.


White balance

Changes white balance mode.

In this option we implemented options available for Raspberry Pi Camera.


Exposure

Changes exposure mode.

In this option we implemented options available for Raspberry Pi Camera.


Contrast

Changes contrast mode.

In this option we implemented options available for Raspberry Pi Camera.


Sharpness

Changes sharpness mode.

Notice: It looks as if this feature has a bug in Raspbian, as it is work with only one camera in stereoscopic mode.

In this option we implemented options available for Raspberry Pi Camera.


Digital gain

Changes digital gain mode. In this option we implemented options available for Raspberry Pi Camera (https://www.raspberrypi.org/documentation/raspbian/applications/camera.md)



Wifi SSID

Name of your WiFi access point

Can be adjusted here or in stereopi.conf file in a BOOT partition


WiFi password

Password for your WiFi.


Updating software

If we have an update, we created a file named stereopi.tar.gz.

You can put it in “BOOT” part of MicroSD. After start, SLP will automatically find and implement it.

You can also do it more comfort way, using "Upload update" button in our Admin panel.



Advanced users’ section


SSH access

You might want to look inside. When you know the IP address of your Pi, you can access it by SSH.

User credentials:

login: root

password: root


SLP structure details you should know

1. We prepared this image for aggressive usage. That’s why we want to save the filesystem in a case of occasional poweroffs. So by default, filesystem is read-only and you cannot change any file. To unlock it type:

sudo mount -o rw,remount /

2. mc already installed, you may use it.

3. Our streaming scripts are here:

/opt/StereoPi

SLP SSH MC screenshot


If you will enter this directory, you can stop all scripts by running:

./stop.sh

To start them again run:

./run.sh

4. Most scripts have auto-restart feature (start again if something go wrong).

5. A few words about “chunker” utility:

We have a lot of projects when we capture video from one source and need to use it in several ways at the same time (like livestream, record and use for Computer Vision). So we need to send it to several applications at the same time. We use a network approach with this, and subsystems of our projects talk with each other over network infrastructure with 127.0.0.1 and different ports. This approach gives us flexibility and we can easily forward video stream to internal subsystem or to external IP address. For example, if you decide to move your OpenCV part from Pi to nearby NVidia Jetson, you just aim livestream from internal IP and port to Jetson’s one. So “in the root” of this system we have special “chunker” utility. It cuts video stream on pieces to fit network bandwidth with maximum efficiency, and try to adapt to maximum MTU available. At this moment this utility is overloaded with a lot of features for our custom projects. We will exclude all unneeded features and open source it after polishing.


Receive livestream on Windows

You need to have gstreamer 1.x installed.

If you already have it, run this script:

gst-launch-1.0 -v udpsrc port=3000 buffer-size=300000 ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false


Receive livestream on Mac

To receive it on Mac you may run the same line:

gst-launch-1.0 -v udpsrc port=3000 buffer-size=300000 ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false

For example, my notebook have IP address 192.168.1.139

To obtain livestream I need:

  1. In SLP Admin panel I turn on "Stream UDP" option
  2. Put "192.168.1.139:3000" in UDP clients field
  3. Press "save" at the bottom of Admin panel
  4. Run gst-launch line in command line on my Mac


My current GStreamer info:

MBP-Evgeny:~ eugene$ gst-launch-1.0 --version
gst-launch-1.0 version 1.14.4
GStreamer 1.14.4
Unknown package origin

Gstreamer have been installed with Brew package manager.


Receive livestream on iOS devices

For iOS we used gstreamer-based Fishing FanCam application, described in EZ-broadcast Wiki.

But looks like this application is not supported now. We plan to do our own application for this, but it might take a lot of time. We will be pleased If you can suggest other gstreamer-based iOS applications or help us with making simple application like our Android one.