I have a Mediasoup 3.12 backend that should mirror a VP8 video Producer into a PlainTransport and then pipe that RTP into FFmpeg (or any external tool) to grab a single JPEG frame. But no matter what I try, FFmpeg never sees a single packet—so it feels like Mediasoup isn’t actually sending my stream out of the PlainTransport.
Environment
- Mediasoup v3.12 on Node.js (Windows)
- FFmpeg 7.1.1 (MSYS2 build)
code
const { spawn } = require('child_process');
const transport = await router.createPlainTransport({
listenIp: '127.0.0.1',
rtcpMux: true,
comedia: false
});
console.log('[POC] PlainTransport tuple:', transport.tuple);
await transport.connect({
ip: transport.tuple.localIp,
port: transport.tuple.localPort
});
console.log('[POC] Transport connected →', transport.tuple.localPort);
const consumer = await transport.consume({
producerId,
rtpCapabilities,
paused: false
});
await consumer.resume();
console.log('[POC] Consumer resumed, packets now streaming');
const ffmpeg = spawn('ffmpeg', [
'-protocol_whitelist', 'file,crypto,data,udp,rtp',
'-probesize', '5000000',
'-analyzeduration', '5000000',
'-f', 'rtp',
'-i', `rtp://127.0.0.1:${transport.tuple.localPort}`,
'-frames:v', '1',
'-q:v', '2',
'snapshot.jpg'
]);
ffmpeg.stderr.on('data', d => console.error('[FFmpeg]', d.toString()));
ffmpeg.on('exit', code => console.log('[POC] FFmpeg exited with', code));
Logs
[POC] PlainTransport tuple: { localIp: '127.0.0.1', localPort: 5004, … }
[POC] Transport connected → 5004
[POC] Consumer resumed, packets now streaming
[
{
"bitrate": 923840,
"byteCount": 7386470,
"firCount": 0,
"fractionLost": 0,
"kind": "video",
"mimeType": "video/VP8",
"nackCount": 0,
"nackPacketCount": 0,
"packetCount": 6463,
"packetsDiscarded": 0,
"packetsLost": 0,
"packetsRepaired": 0,
"packetsRetransmitted": 0,
"pliCount": 0,
"rtxPacketsDiscarded": 0,
"rtxSsrc": 201200048,
"score": 10,
"ssrc": 201200047,
"timestamp": 1601779499,
"type": "outbound-rtp"
},
{
"bitrate": 917466,
"byteCount": 7334770,
"firCount": 0,
"fractionLost": 0,
"jitter": 7,
"kind": "video",
"mimeType": "video/VP8",
"nackCount": 0,
"nackPacketCount": 0,
"packetCount": 6463,
"packetsDiscarded": 0,
"packetsLost": 0,
"packetsRepaired": 0,
"packetsRetransmitted": 4,
"pliCount": 0,
"roundTripTime": 1.2664794921875,
"rtxPacketsDiscarded": 0,
"rtxSsrc": 1621317588,
"score": 10,
"ssrc": 418701061,
"timestamp": 1601779499,
"type": "inbound-rtp"
}
]
[FFmpeg] ffmpeg version 7.1.1-full_build-www.gyan.dev … // Banner only, then hangs
[POC] FFmpeg exited with <non-zero> (or never exits)
no frame output, and FFmpeg just blocks waiting for input.
What I’ve already tried
- comedia on/off — both modes, always the same
- explicit
consumer.resume()after paused=true - writing an SDP file with
a=framesize&a=framerate - passing
-video_sizeor-framesizeon the FFmpeg CLI - spawning FFmpeg before vs. after
transport.connect()andconsumer.resume() - huge
-probesize/-analyzedurationto force codec detection
No matter the combination, FFmpeg never receives a single packet.
My Questions
- Is there a step in the PlainTransport lifecycle I’m missing?
- Do I need to wire RTCP explicitly (e.g. a separate
rtcpPort) even withrtcpMux: true? - How can I verify that Mediasoup is actually pushing RTP out of the transport?
- Any minimal working example of sending VP8 RTP from a Mediasoup consumer into FFmpeg (or a raw UDP listener) would be hugely appreciated.
Thanks in advance for any guidance—right now it feels like Mediasoup simply isn’t sending my stream out, and I can’t figure out why.
