Greetings!
First of all thanks for awesome project, its crazy.
So, i need some help.
I’m using an mediasoup-demo and trying to record video with fluent-ffmpeg
My idea is to start recording video right after new customer connected. I’m think about getting RTP packets and write with fs.fileWriteStream and than convert them to needed format with ffmpeg
So what it done:
const tempFilePath = path.join(__dirname, '..', 'recording', `${Date.now()}.webm`);
const fileWriteStream = fs.createWriteStream(tempFilePath);
const directTransport = await this._mediasoupRouter.createDirectTransport();
const directProducer = await directTransport.produce({
kind : producer.kind,
rtpParameters : producer.rtpParameters
});
const directConsumer = await directTransport.consume({
producerId : directProducer.id,
rtpCapabilities : this._mediasoupRouter.rtpCapabilities
});
directConsumer.on('rtp', (rtpPacket) =>
{
logger.info('rtpPacket', rtpPacket);
const buffer = Buffer.from(rtpPacket.data);
fileWriteStream.write(buffer);
});
directProducer.on('transportclose', () =>
{
const ffmpegProcess = ffmpeg()
.input(tempFilePath)
.outputOptions([
'-c:v libx264',
'-preset ultrafast'
])
.output('output.mp4')
.on('end', () =>
{
logger.info('Video conversion finished');
fs.unlinkSync(tempFilePath);
})
.run();
});
But after connection and trying to producing data i have an error
RTC::DirectTransport::SendRtpPacket() | cannot send RTP packet not associated to a Consumer
I read the documentation (which is also great) but cant find any solution with this.
Can anybody help me?
Thanks and have a nice day!