---
# System prepended metadata

title: Crawler Video Streaming Notes

---

# Crawler Video Streaming Notes


### 1) Starting RTSP Server (Ground Station PC)

#### create remote.bash file in ~/.
``` bash
#filename=remote.bash (GroundStation)
export ROS_MASTER_URI=http://10.223.240.0:11311
export ROS_IP=10.223.240.0
```

#### Run RTSP server
```bash=
source ~/remote.bash
sudo docker run --rm -it --network=host aler9/rtsp-simple-server
```

#### Sample Output

```bash
2022/06/28 08:00:14 INF rtsp-simple-server v0.19.1
2022/06/28 08:00:14 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2022/06/28 08:00:14 INF [RTMP] listener opened on :1935
2022/06/28 08:00:14 INF [HLS] listener opened on :8888

```

### 2) Streaming Camera Feed (Onboard PC)

#### create remote.bash file in ~/.
``` bash
#filename=remote.bash (OnboardComputer)
export ROS_MASTER_URI=http://10.223.240.0:11311
export ROS_IP=10.223.240.1
```

#### Package : OctoROS_Streaming_Utils
```bash=
git clone git@github.com:octobotics/OctoROS-Streaming-Utils.git
```


#### Compilation:
``` bash=
cd ~/OctoROS-Streaming-Utils/src/gstreamer_utils
gcc camera1.c -o camera1 `pkg-config --cflags --libs gstreamer1.0`
gcc camera2.c -o camera2 `pkg-config --cflags --libs gstreamer1.0`
gcc camera3.c -o camera3 `pkg-config --cflags --libs gstreamer1.0`
    
sudo chmod +x camera1 camera2 camera3
```

#### Streaming CSI Camera Feed Over Gstreamer (1096p)
``` bash=
source ~/remote.bash
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera1 10.223.240.0 & \
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera2 10.223.240.0 & \
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera3 10.223.240.0
```

#### Streaming CSI Camera Feed Over Gstreamer (480p)
``` bash=
source ~/remote.bash
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera1_compressed 10.223.240.0 & \
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera2_compressed 10.223.240.0 & \
~/OctoROS-Streaming-Utils/src/gstreamer_utils/camera3_compressed 10.223.240.0
```

### Accessing Raw Video Feed (Ground Station PC)

```bash=
gst-launch-1.0 rtspsrc location=rtsp://10.223.240.0:8554/cam1 latency=0 ! decodebin ! videoconvert ! autovideosink & \
gst-launch-1.0 rtspsrc location=rtsp://10.223.240.0:8554/cam2 latency=0 ! decodebin ! videoconvert ! autovideosink & \
gst-launch-1.0 rtspsrc location=rtsp://10.223.240.0:8554/cam3 latency=0 ! decodebin ! videoconvert ! autovideosink & 
```

### Converting Video Feed To ROS Topics (Ground Station PC)

#### Update rtsp urls in launch file

```bash=
sudo nano ~/OctoROS-Streaming-Utils/src/cuda_video_streaming/launch/rtsp2ros.launch 
``` 

```nano
...otics/OctoROS-Streaming-Utils/src/cuda_video_streaming/launch/rtsp2ros.launch

<launch>
    <arg name="rtsp_urls"
         default="rtsp://10.223.240.0:8554/cam1,rtsp://10.223.240.0:8554/cam2,r$
    <node pkg="cuda_video_streaming" type="cuda_video_streaming_node" name="Rts$
        <param name="rtsp_urls" value="$(arg rtsp_urls)"/>
    </node>
</launch>


                                [ Read 7 lines ]
^G Get Help  ^O Write Out ^W Where Is  ^K Cut Text  ^J Justify   ^C Cur Pos
^X Exit      ^R Read File ^\ Replace   ^U Uncut Text^T To Spell  ^_ Go To Line

```
##### Press Ctrl x, y and return

#### Launch the cuda video converter node
```bash=
source ~/remote.bash
cd ~/OctoROS-Streaming-Utils
source devel/setup.bash
roslaunch cuda_video_streaming rtsp2ros.launch 
```