You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GStreamer录制Pepper机器人音频无声音问题求助及RTP流咨询

Troubleshooting Silent Audio Recording from Pepper via GStreamer RTP

Hey there! Let's figure out why you're ending up with silent MP3 files and get your audio streaming working properly. I'll break down the issues with your current commands, fix them, and walk you through how RTP works for audio transfer.

First, What's Wrong with Your Current Setup?

Your commands have three critical issues that lead to silent files:

  1. No RTP encapsulation: You're sending raw audio directly over UDP, which lacks the timing, synchronization, and packet sequencing that RTP provides. This can cause the receiver to misinterpret or drop audio data entirely.
  2. Invalid MP3 writing: You're trying to save raw PCM audio directly as an MP3 file. MP3 requires specific compression encoding—raw audio isn't formatted correctly for the MP3 container, so players can't decode it (hence the silence).
  3. Caps syntax error: On the Pepper side, your audio caps use a semicolon (;) instead of a comma (,) to separate properties. GStreamer 0.10 expects commas for caps attributes, so this might be preventing proper format matching.

Fixed Commands for RTP Audio Streaming

Pepper Side (GStreamer 0.10)

We'll add RTP encapsulation using rtpL16Pay (ideal for 16-bit PCM audio) and fix the caps syntax:

gst-launch-0.10 alsasrc name=mic provide-clock=true do-timestamp=true buffer-time=200000 mic. ! 'audio/x-raw-int, format=S16LE, channels=1, width=16, depth=16, rate=16000' ! rtpL16pay ! udpsink host="your_computer_ip" port="your_udp_port" sync=false
  • rtpL16pay: Packages raw 16-bit audio into RTP packets, adding necessary metadata like timestamps and sequence numbers for reliable streaming.

Computer Side (GStreamer 1.0)

We'll decode the RTP stream, encode the audio to MP3 properly, then save it:

gst-launch-1.0 -e udpsrc port="your_udp_port" ! application/x-rtp, media=audio, clock-rate=16000, channels=1, encoding-name=L16 ! rtpL16depay ! audioconvert ! lamemp3enc ! filesink location=recorded_audio.mp3 sync=false
  • application/x-rtp, ...: Explicitly tells GStreamer the incoming RTP stream's format (matches the Pepper side's settings).
  • rtpL16depay: Unpacks the RTP packets back into raw audio.
  • lamemp3enc: Encodes the raw audio into valid MP3 format—this is essential for creating a playable MP3 file.
  • -e: Ensures the file is properly closed when you stop the stream, avoiding corrupted MP3s.

Core Concepts for RTP Audio Streaming with Pepper

  1. RTP is non-negotiable for reliable streaming: Unlike raw UDP, RTP is designed for real-time media. It adds metadata that helps the receiver handle jitter, packet loss, and synchronization. Always use RTP payloaders/depayloaders when streaming audio/video over networks.
  2. Caps must match exactly: The audio format (sample rate, channels, bit depth) on the sender (Pepper) must perfectly match the RTP caps on the receiver (your computer). Mismatches will cause the receiver to reject or misinterpret the audio.
  3. GStreamer version differences: GStreamer 0.10 (Pepper) uses audio/x-raw-int for raw audio, while 1.0 uses audio/x-raw. But since we're using RTP encapsulation, this difference is hidden—we just need to ensure the RTP payload settings align.
  4. Test incrementally:
    • First, verify Pepper's mic works: Run gst-launch-0.10 alsasrc ! 'audio/x-raw-int, format=S16LE, channels=1, rate=16000' ! autoaudiosink on Pepper and check if you can hear audio.
    • Test network connectivity: Use nc -u -l your_port on your computer and echo "test" | nc -u your_computer_ip your_port on Pepper to confirm UDP packets can pass through.
    • Test raw UDP first (without RTP) to rule out format issues: Stream to autoaudiosink on your computer instead of saving to file to see if you can hear audio.

内容的提问来源于stack exchange,提问作者Fabian Fournier

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 13:42:53