`Hello! I'm using TrackEgress to stream an audio t...
# ask-ai
f
Hello! I'm using TrackEgress to stream an audio track (audio/opus) to my Node.js server via WebSocket. My server receives the audio chunks fine.
When I pipe these chunks to an ffmpeg child process using "-i pipe:0", ffmpeg crashes with the error: "Error opening input: Invalid data found when processing input".
My ffmpeg command is: ffmpeg -i pipe:0 -f s16le -ar 16000 -ac 1 pipe:1
What is the exact container format (e.g., Ogg) of the WebSocket stream from TrackEgress? What are the correct ffmpeg input flags (like -f and -c:a) required to reliably decode this stream from stdin?
t
Thanks for reaching out, Priyanshu. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just wanted to share some info about the WebSocket stream from TrackEgress — it uses raw PCM data as the container format. Here’s the lowdown: • Format: pcm_s16le (that’s signed 16-bit little endian PCM) • Sample rate: Usually 48kHz • Channels: Stereo (2 channels) If you want to decode this stream using ffmpeg, you can use these input flags:
Copy code
ffmpeg -f s16le -ac 2 -ar 48000 -i pipe:0
Just a heads up — make sure you only grab the binary frames that actually contain audio data from the WebSocket stream before sending them to ffmpeg. The stream might also have text frames with JSON events mixed in, so filtering those out will keep things running smoothly. Sources: Track Egress | LiveKit Docs | Universal Egress | pkg/pipeline/builder/video.go