Reachy Mini documentation

📡 Instalación de GStreamer

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

📡 Instalación de GStreamer

Esta guía le ayudará a instalar GStreamer para recibir flujos de video y audio de su Reachy Mini. Consulte la arquitectura de medios para comprender cómo se accede a los flujos de forma local o remota según la configuración.

Las ruedas de Python están disponibles para las plataformas Windows y macOS e incluidas en las dependencias del proyecto. Todo debería funcionar sin necesidad de configuración adicional. Solo los usuarios de Linux requieren una instalación manual.

🐧 Linux🍎 macOS🪟 Windows
⚠️ Instalación manual✅ Ruedas de Python✅ Ruedas de Python

🔧 Instale GStreamer y los complementos de webrtc

Paso 1: Instalar GStreamer

Para sistemas basados en Ubuntu/Debian:

En tu terminal, ejecuta:

sudo apt-get update
sudo apt-get install \
    libgstreamer-plugins-bad1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    libgstreamer1.0-dev \
    libglib2.0-dev \
    libssl-dev \
    libgirepository1.0-dev \
    libcairo2-dev \
    libportaudio2 \
    libnice10 \
    gstreamer1.0-plugins-good \
    gstreamer1.0-alsa \
    gstreamer1.0-plugins-bad \
    gstreamer1.0-nice \
    python3-gi \
    python3-gi-cairo    

Solo para Ubuntu 22.04: La versión predeterminada de GStreamer es demasiado antigua. Se requiere Gstreamer >=1.22. Debes agregar un PPA para obtener GStreamer 1.24.x:

sudo add-apt-repository ppa:savoury1/multimedia
sudo apt update
sudo apt install \
    libgstreamer1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    libgstreamer-plugins-good1.0-dev \
    libgstreamer-plugins-bad1.0-dev

Verifica que tienes la versión correcta:

pkg-config --modversion gstreamer-1.0
# Should output 1.24.x or higher

Paso 2: Instalar Rust

En Linux, el plugin de WebRTC no está habilitado de forma predeterminada y debe compilarse manualmente desde el código fuente de Rust. Instala Rust desde la línea de comandos usando rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Paso 3: Compilar e instalar el plugin de WebRTC

Para compilar e instalar el plugin de WebRTC, ejecute los siguientes comandos:

# Clone the GStreamer Rust plugins repository
git clone https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
cd gst-plugins-rs
# 0.14.5 ships a critical webrtcsink fix for a deadlock between
# remote description and ICE handling that manifested on the
# daemon as the historical "stuck at session" UX (the JS client
# spinning forever because libnice never reached `connected`).
# Older 0.14.x tags (0.14.1, 0.14.2, 0.14.3) do NOT carry this
# fix; see the upstream CHANGELOG. The daemon-side negotiation
# watchdog (`reachy_mini.media.media_server`) is the safety net,
# but pinning to a fixed plugin means that net should rarely fire.
git checkout 0.14.5

# Install the cargo-c build tool
cargo install cargo-c

# Create installation directory
sudo mkdir -p /opt/gst-plugins-rs
sudo chown $USER /opt/gst-plugins-rs

# Build and install the WebRTC plugin (this may take several minutes)
cargo cinstall -p gst-plugin-webrtc --prefix=/opt/gst-plugins-rs --release

# Add plugin path to your environment
echo 'export GST_PLUGIN_PATH=/opt/gst-plugins-rs/lib/x86_64-linux-gnu:$GST_PLUGIN_PATH' >> ~/.bashrc
source ~/.bashrc

💡 Nota: En sistemas ARM64 (como Raspberry Pi), reemplaza x86_64-linux-gnu por aarch64-linux-gnu en el comando de exportación.

✅ Verificar la instalación

Finalmente, puedes probar tu instalación de GStreamer de la siguiente manera:

# install the optional tools
sudo apt install gstreamer1.0-tools

# Check version
gst-launch-1.0 --version

# Test basic functionalities
gst-launch-1.0 videotestsrc ! autovideosink

# Verify WebRTC plugin
gst-inspect-1.0 webrtcsrc

También debería ser posible importar las bibliotecas de GStreamer en un entorno de Python:

python -c "import gi"

Solución de problemas y pruebas unitarias

Si encuentras problemas con el flujo, puedes probar los componentes individualmente de la siguiente manera.

Prueba 1: Crear manualmente el servidor WebRTC Ejecuta este pipeline de GStreamer en el robot para verificar la cámara y la pila de codificación:

gst-launch-1.0 webrtcsink run-signalling-server=true meta="meta,name=reachymini" name=ws libcamerasrc ! capsfilter caps=video/x-raw,width=1280,height=720,framerate=60/1,format=YUY2,colorimetry=bt709,interlace-mode=progressive ! queue !  v4l2h264enc extra-controls="controls,repeat_sequence_header=1" ! 'video/x-h264,level=(string)4' ! ws. alsasrc device=hw:4 ! queue ! audioconvert ! audioresample ! opusenc ! audio/x-opus, rate=48000, channels=2 ! ws.
Update on GitHub