I'm trying to record audio on a webrtc server in NodeJS using FFmpeg.
I am able to record the audio if I explicitly create an input.sdp file and use it with the "-i" flag of FFmpeg.
My question is: How to create a string in the code to dynamically change port numbers for recording different streams at the same time?
I tried doing this:
const sdpInfo = `data:application/sdp;charset=UTF-8,v=0\no=- 0 0 IN IP4 ${ipAddr}\ns=-\nc=IN IP4 ${ipAddr}\nt=0 0\nm=audio ${port} RTP/AVPF 111\na=rtcp:${port+1}\na=rtpmap:111 opus/48000/2\na=fmtp:111 minptime=10;useinbandfec=1`
However, if I give it as input with "-i" flag, I get the following error:
data:application/sdp;charset=UTF-8,v=0: Invalid data found when processing input
Can someone please help?