Skip to content

Commit

Permalink
Address stream artifacting (#4)
Browse files Browse the repository at this point in the history
* Added underwater calibration

* Updated readme

* Default to underwater calibrations

* Resolved artifacting issue in stream
  • Loading branch information
evan-palmer authored Nov 14, 2024
1 parent d0df01f commit 5652ffb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ Netmask: 255.255.255.0
Gateway: 192.168.1.1
```

After establishing a connection, verify the RTSP stream using FFmpeg

```bash
ffplay -fflags nobuffer -flags low_delay -probesize 32 -rtsp_transport tcp -i "rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp?"
```

The stream can also be recorded using

```bash
ffmpeg -i "rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp?" -c:v copy -an recording.mp4
```

## Using MediaMTX proxy

MediaMTX can be used to connect to the RTSP server embedded into the camera to
Expand All @@ -41,22 +53,10 @@ docker compose up

Once running, the stream can be played using FFmpeg

```bash
ffplay rtsp://<your-ip-address>:<mediamtx-port>/barlus
```

For low latency FFmpeg streaming, run the following

```bash
ffplay -fflags nobuffer -flags low_delay -probesize 32 -rtsp_transport udp -i rtsp://<your-ip-address>:<mediamtx-port>/barlus
```

The stream can also be recorded using

```bash
ffmpeg -i rtsp://<your-ip-address>:<mediamtx-port>/barlus -c:v copy -an recording.mp4
```

## ROS 2 interface

`barlus_gstreamer_proxy` has been implemented to convert frames received from
Expand Down
15 changes: 14 additions & 1 deletion barlus_gstreamer_proxy/config/gstreamer_proxy.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
/barlus/gstreamer_proxy:
ros__parameters:
stream_address: rtsp://192.168.1.17:8554/barlus
# The default RTSP stream address for the Barlus UW-S5-3PBX10 underwater camera.
# If using MediaMTX, this should be the address of the MediaMTX server, e.g.,
# stream_address: rtsp://192.168.1.17:8554/barlus
stream_address: rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp

# The path to the camera info file. This file contains the camera calibration information.
camera_info_url: package://barlus_gstreamer_proxy/config/camera_info_underwater.yaml

# The frame ID of the camera.
frame_id: camera_link

# The default width of the camera image.
image_width: 3072

# The default height of the camera image.
image_height: 2048

# The name of the camera.
camera_name: barlus
2 changes: 1 addition & 1 deletion barlus_gstreamer_proxy/src/gstreamer_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ auto GStreamerProxy::configure_stream() -> bool
RCLCPP_INFO(get_logger(), "Starting GStreamer pipeline with address: %s", params_.stream_address.c_str()); // NOLINT

// The following configurations are intended for low-latency transport
const std::string video_source = "rtspsrc location=" + params_.stream_address + " latency=0";
const std::string video_source = "rtspsrc location=" + params_.stream_address + " protocols=tcp";
const std::string video_codec = "! rtph264depay ! h264parse ! avdec_h264";
const std::string video_decode = "! decodebin ! videoconvert ! video/x-raw,format=(string)BGR";
const std::string video_sink_conf = "! queue ! appsink emit-signals=true sync=false max-buffers=1 drop=true";
Expand Down
2 changes: 1 addition & 1 deletion barlus_gstreamer_proxy/src/gstreamer_proxy_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gstreamer_proxy:

stream_address:
type: string
default_value: rtsp://192.168.1.17:8554/barlus
default_value: rtsp://192.168.1.10:554/user=admin&password=&channel=1&stream=0.sdp
description: The RTSP stream address. This can be either the stream from the camera itself or from MediaMTX.

camera_info_url:
Expand Down

0 comments on commit 5652ffb

Please sign in to comment.