Skip to content

Commit

Permalink
enhancement #48: provide dockerfile for an easier use of the recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienDanieau committed Aug 9, 2024
1 parent 914b904 commit f4eb792
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ dev = black==23.10.1

[options.entry_points]
console_scripts =
gst-webrtc-producer-list = example.get_producer_list:main
gst-webrtc-producer-list = examples.get_producer_list:main
gst-webrtc-video-recorder = examples.recorder.simple_recorder:main


[flake8]
Expand Down
16 changes: 14 additions & 2 deletions src/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@

WebRTC client that records the streams into gdp files, and then mux them into a mp4. Gstreamer rust plugins must be installed. Please follow the [documentation](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc).

You can directly provided the peer webrtc name (i.e. *robot* for Reachy), or the peer id. Please use --help for more details about the command.
You can directly provide the peer webrtc name (i.e. *robot* for Reachy), or the peer id. Please use --help for more details about the command.

The recorder can be started as follow and will generate a mp4 file.

```shell
python src/examples/simple_recorder.py --remote-producer-peer-name robot
python src/examples/recorder/simple_recorder.py --remote-producer-peer-name robot --signaling-host <ip_robot>
```

A Dockerfile is also provided to ease the avoid the compilation of the rust plugins. Navigate to the parent folder of the cloned repo (i.e. `cd ../../..` from this README.md), and build the image

```shell
docker build -t webrtcrecorder -f gst-signalling-py/src/examples/recorder/Dockerfile .
```

Then run the recorder from within a container. Change `~/Videos/`by the path where you want the recording to be saved to.

```shell
docker run --network host -v ~/Videos/:/root/output webrtcrecorder --remote-producer-peer-name robot --signaling-host <ip_robot> --output /root/output/recording.mp4
```

## Signalling tools
Expand Down
33 changes: 33 additions & 0 deletions src/examples/recorder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ubuntu:24.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl libssl-dev git python3-pip pkg-config libcairo2-dev gcc python3-dev \
libgirepository1.0-dev python3-gst-1.0 gir1.2-gst-plugins-bad-1.0 gstreamer1.0-plugins-bad \
gstreamer1.0-nice libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgstreamer-plugins-bad1.0-dev gstreamer1.0-tools python3-pyee python3-numpy python3-websockets

# Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo install cargo-c

RUN mkdir /src

#Compile gstreamer webrtc plugin.
WORKDIR /src

RUN git clone -b 0.12.8 --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
WORKDIR /src/gst-plugins-rs
RUN cargo cbuild -p gst-plugin-webrtc --prefix=/usr
RUN cargo cinstall -p gst-plugin-webrtc --prefix=/usr


COPY gst-signalling-py /src/gst-signalling-py
WORKDIR /src/gst-signalling-py

RUN pip install --no-deps --break-system-packages .

WORKDIR /root
RUN mkdir /root/output

ENTRYPOINT [ "gst-webrtc-video-recorder" ]
Empty file.
File renamed without changes.

0 comments on commit f4eb792

Please sign in to comment.