Giter VIP home page Giter VIP logo

mediasoup3-record-demo's Introduction

Simple video/audio Record Demo Using mediasoup 3 and GStreamer/FFmpeg


Introduction

Simple video/audio record application using Mediasoup and GStreamer

Recorded files are stored in the server's files directory or the directory set by the user (via process.env.RECORD_FILE_LOCATION_PATH)

File names are simply the current timestamp

This sample currently only uses VP8/opus and the output file is .webm


How to use

Install GStreamer

# For Ubuntu
sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

Install Server Modules

cd server && npm i

Install App Modules

cd app && npm i

Configure the server

Change the announced IP in src/config.js to your local ip (config -> webRtcTransport -> listenIps)

Start the server

# The server uses FFmpeg as default
cd server && node src/server

# To use GStreamer
PROCESS_NAME="GStreamer" node src/server

Build and start the application

cd app
npm run build

# Copy the files from dist to a webserver etc.
# OR start the dev server
npm run dev

Access the sample page

https://localhost:8080

By default recorded videos will be available in server/files directory.


Server ENV Options

Argument Type Explanation
RECORD_FILE_LOCATION_PATH string Path to store the recorded files (user running node MUST have read/write permission)
GSTREAMER_DEBUG_LEVEL number GStreamer Debug Level (GStreamer only)
PROCESS_NAME string The command to use (GStreamer/FFmpeg) (case sensitive) default is FFmpeg
SERVER_PORT number Server port number (default is 3000). Note if you change this you will also need to edit the WebSocket connection url.

TODO

  • video/audio only recording
  • Multiple formats (mp4/avi etc)
  • Docker support

Like my work? Any support is appreciated.

Buy Me A Coffee

mediasoup3-record-demo's People

Contributors

arzeth avatar dependabot[bot] avatar dirvann avatar envek avatar ethand91 avatar universeroc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mediasoup3-record-demo's Issues

Demo Request: Switching between multiple video tracks

I've been looking at your example, and attempting to figure out how to do an "active speaker" recording implementation. Do you have any idea how to negotiate/renegotiate multiple video tracks with FFMPEG or Gstreamer as participants might come and go, then then specify which track to actively record/map?

[Docker] Could not find codec parameters for stream 0: unspecified size

Hi,

I used this project as a reference to work on a PoC.

When I run it via the node process using this command: MEDIASOUP_ANNOUNCED_IP=192.168.72.195 node src/server.js, it is working fine.

However, when I use Docker to run the server folder on its own, I encounter this error, which also reported by others:

socket::message [jsonMessage:{ action: 'start-record',
  sessionId: '94147960-fca3-11ea-aa3b-7bea084a9b34' }]
handleStartRecordRequest() [data:{ action: 'start-record',
  sessionId: '94147960-fca3-11ea-aa3b-7bea084a9b34' }]
publishProducerRtpStream()
createTransport() [type:plain. options:{ listenIp: { ip: '0.0.0.0', announcedIp: '15ac65b5e06b.ngrok.io' },
  rtcpMux: true,
  comedia: false,
  maxSctpMessageSize: 262144 }]
  mediasoup:WARN:Router createPlainRtpTransport() is DEPRECATED, use createPlainTransport() +0ms
videoCodecInfo { payloadType: 100,
  codecName: 'H264',
  clockRate: 90000,
  channels: undefined }
createProcess() [sdpString:v=0
  o=- 0 0 IN IP4 0.0.0.0
  s=FFmpeg
  c=IN IP4 0.0.0.0
  t=0 0
  m=video 25386 RTP/AVP 100 
  a=rtpmap:100 H264/90000
  a=sendonly
  ]
commandArgs:[ '-analyzeduration',
  '2147483647',
  '-probesize',
  '2147483647',
  '-loglevel',
  'debug',
  '-protocol_whitelist',
  'pipe,udp,rtp',
  '-fflags',
  '+genpts',
  '-f',
  'sdp',
  '-i',
  'pipe:0',
  '-map',
  '0:v:0',
  '-c:v',
  'copy',
  '-flags',
  '+global_header',
  '/files/1600759010577.mp4',
  [length]: 21 ]
ffmpeg::process::data [data:'ffmpeg version 3.2.15-0+deb9u1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version=0+deb9u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
']
ffmpeg::process::data [data:'Splitting the commandline.
Reading option \'-analyzeduration\' ... matched as AVOption \'analyzeduration\' with argument \'2147483647\'.
Reading option \'-probesize\' ... matched as AVOption \'probesize\' with argument \'2147483647\'.
Reading option \'-loglevel\' ... matched as option \'loglevel\' (set logging level) with argument \'debug\'.
Reading option \'-protocol_whitelist\' ...']
ffmpeg::process::data [data:' matched as AVOption \'protocol_whitelist\' with argument \'pipe,udp,rtp\'.
Reading option \'-fflags\' ... matched as AVOption \'fflags\' with argument \'+genpts\'.
Reading option \'-f\' ... matched as option \'f\' (force format) with argument \'sdp\'.
Reading option \'-i\' ... matched as input url with argument \'pipe:0\'.
Reading option \'-map\' ... matched as option \'map\' (set input stream mapping) with argument \'0:v:0\'.
Reading option \'-c:v\' ... matched as option \'c\' (codec name) with argument \'copy\'.
Reading option \'-flags\' ...']
ffmpeg::process::data [data:' matched as AVOption \'flags\' with argument \'+global_header\'.
Reading option \'/files/1600759010577.mp4\' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url pipe:0.
Applying option f (force format) with argument sdp.
Successfully parsed a group of options.
Opening an input file: pipe:0.
[sdp @ 0x558b31bd7ec0] Opening \'pipe:0\' for reading
[sdp @ 0x558b31bd7ec0] video codec set to: h264
[udp @ 0x558b31be2ae0] end receive buffer size reported is 131072
[udp @ 0x558b31be2420] end receive buffer size reported is 131072
[sdp @ 0x558b31bd7ec0] setting jitter buffer size to 500
[sdp @ 0x558b31bd7ec0] Before avformat_find_stream_info() pos: 137 bytes read:137 seeks:0 nb_streams:1
']
ffmpeg::process::data [data:'[sdp @ 0x558b31bd7ec0] Could not find codec parameters for stream 0 (Video: h264, 1 reference frame, none(left)): unspecified size
Consider increasing the value for the \'analyzeduration\' and \'probesize\' options
[sdp @ 0x558b31bd7ec0] After avformat_find_stream_info() pos: 137 bytes read:137 seeks:0 frames:0
']
ffmpeg::process::data [data:'Input #0, sdp, from \'pipe:0\':
  Metadata:
    title           : FFmpeg
  Duration: N/A, bitrate: N/A
    Stream #0:0, 0, 1/90000: Video: h264, 1 reference frame, none(left), 90k tbr, 90k tbn, 180k tbc
Successfully opened the file.
Parsing a group of options: output url /files/1600759010577.mp4.
Applying option map (set input stream mapping) with argument 0:v:0.
Applying option c:v (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /files/1600759010577.mp4.
']
ffmpeg::process::data [data:'[file @ 0x558b31be5700] Setting default whitelist \'file,crypto\'
']
ffmpeg::process::data [data:'Successfully opened the file.
[mp4 @ 0x558b31be3300] dimensions not set
']
ffmpeg::process::data [data:'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argumentStream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times
[AVIOContext @ 0x558b31be55c0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x558b31bd86c0] Statistics: 137 bytes read, 0 seeks
']
ffmpeg::process::close
socket::message [jsonMessage:{ action: 'stop-record',
  sessionId: '94147960-fca3-11ea-aa3b-7bea084a9b34' }]
handleStopRecordRequest() [data:{ action: 'stop-record',
  sessionId: '94147960-fca3-11ea-aa3b-7bea084a9b34' }]
kill() [pid:18]

I was referencing this repo for the docker setup: https://github.com/versatica/mediasoup-demo/blob/v3/server/Dockerfile

I tried changing the ANNOUNCED_IP (e.g. docker's "external" bridge IP such as 172.x.x.x, or my host machine's IP which is 192.168.x.x, also tried 0.0.0.0) and LISTEN_IP (tried docker's local ip, 127.0.0.1, and 0.0.0.0 as well) with different combination to no avail. I use ngrok (ngrok http https://localhost:3000) to expose the server process externally so that browser won't complain about "secure" websocket connection (ignore this as I found out it's irrelevant).

here is my config file:

const os = require('os');

module.exports = Object.freeze({
  numWorkers: Object.keys(os.cpus()).length,
  worker: {
    logLevel: 'debug',
    logTags: [
      'rtp',
      'srtp',
      'rtcp',
    ],
    rtcMinPort: 40000,
    rtcMaxPort: 49999
  },
  router: {
    mediaCodecs: [
      {
        kind: 'video',
        mimeType: 'video/h264',
        clockRate: 90000,
        parameters :
					{
						'packetization-mode'      : 1,
						'profile-level-id'        : '42e01f',
						'level-asymmetry-allowed' : 1,
						'x-google-start-bitrate'  : 1000
					}
      }
    ]
  },
  webRtcTransport: {
    listenIps: [ { ip: process.env.MEDIASOUP_LISTEN_IP || '0.0.0.0', announcedIp: process.env.MEDIASOUP_ANNOUNCED_IP || undefined } ],
    enableUdp: true,
    enableTcp: true,
    preferUdp: true,
    initialAvailableOutgoingBitrate : 1000000,
    minimumAvailableOutgoingBitrate : 600000,
    maxSctpMessageSize              : 262144,
    maxIncomingBitrate              : 1500000
  },
  plainRtpTransport: {
    listenIp: { ip: process.env.MEDIASOUP_LISTEN_IP || '0.0.0.0', announcedIp: process.env.MEDIASOUP_ANNOUNCED_IP || undefined },
    rtcpMux: true,
    comedia: false,
    maxSctpMessageSize : 262144
  }
});

mediasoup version is 3.6.21 and mediasoup-client version is 3.6.14

Wondering if anyone could offer some guidance on how to resolve this issue?

Appreciate any help.

UnsupportedError: no compatible media codecs

Hi,
I am trying to run this in Chrome on Mac (running the App and Server) on the same machine.
When I hit the play button, I get this in the server console:

(node:72712) UnhandledPromiseRejectionWarning: UnsupportedError: no compatible media codecs

I have FFMPEG installed.

Is there any way you could point me in the right direction?

trying to get live audio by gstream

Hi,
sorry for a noob question. I'm trying to use the demo as a base to get live audio/video from the stream. Starting with audio for simplicity. So if I take the videoArgs out of the command arguments for gst-launch-1.0, I still get the .webm file recorded with the audio track. So far so good. Now I try to insert a T into the chain, for example like this:
return [
udpsrc port=${audio.remoteRtpPort} caps="${AUDIO_CAPS}",
'!',
'rtpbin.recv_rtp_sink_1 rtpbin.',
'!',
'queue',
'!',
'rtpopusdepay',
'!',
'opusdec',
'!',
'tee name=t ',
'! queue',
'! ',
'audioresample ! audioconvert !',
'alsasink',
't. ' ,
'! queue',
'!',
'opusenc',
'!',
'mux.'

];

the file is still recorded but not played in real time. Probably my stupid misunderstanding of the gstream... Can anyone suggest a very simple pipeline to only get audio from the demo? I can go from there. Thanks.

Bash script with ffmpeg ?

Do you think it is possible to record a mediasoup stream with some bash script and ffmpeg ?
(without having to write some node server side script)

(similar solution to broadcast script provided here: mediasoup-demo/ffmpeg.sh at v3 · versatica/mediasoup-demo · GitHub)

Regards

Could not find codec parameters for stream 0.

Hi!

I made a lot of things trying to address everything but with no result. Please help, I'm ready to donate for the solution =)
I changed the listenIps, wrote down all certs, created a files folder.
I found out that payload parameters aren't the same from message and sdp. I changed them, but this gave nothing.
--enable-libvpx --enable-libvorbise --enable-libopus are enabled.
Here is the initial output:

mediasoup loaded [version:3.4.8]
starting server [processName:FFmpeg]
initializeWorkers() creating 1 mediasoup workers
createRouter() creating new router [worker.pid:14195]
Socket Server listening on port 3000
new socket connection [iphttps://rfst.ru]
socket::message [jsonMessage:{
  action: 'create-transport',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3'
}]
createTransport() [type:webRtc. options:undefined]
sending response {
  action: 'create-transport',
  id: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  iceParameters: {
    iceLite: true,
    password: '9j0ewuhqbo7r3msb6kprtryb49w8gjtk',
    usernameFragment: '4mfdzpc5mjqmy9z2'
  },
  iceCandidates: [
    {
      foundation: 'udpcandidate',
      ip: '127.0.0.1',
      port: 48383,
      priority: 1076558079,
      protocol: 'udp',
      type: 'host'
    },
    {
      foundation: 'tcpcandidate',
      ip: '127.0.0.1',
      port: 49906,
      priority: 1076302079,
      protocol: 'tcp',
      tcpType: 'passive',
      type: 'host'
    },
    [length]: 2
  ],
  dtlsParameters: {
    fingerprints: [
      {
        algorithm: 'sha-1',
        value: 'B2:58:1F:32:DB:8C:26:4F:46:09:9A:58:7D:AA:29:A9:77:D4:08:1E'
      },
      {
        algorithm: 'sha-224',
        value: 'D2:10:A4:47:A4:3D:3B:66:43:49:6C:B6:C9:F7:59:05:8F:75:F0:7A:D5:A9:2D:71:3B:1C:67:10'
      },
      {
        algorithm: 'sha-256',
        value: '8F:33:FB:52:B0:C2:CC:F4:46:BF:25:66:67:F6:FA:8F:4D:C3:E1:71:88:C7:A7:71:01:4E:B6:34:A8:D5:D9:95'
      },
      {
        algorithm: 'sha-384',
        value: '59:66:5C:79:E5:01:66:8C:84:3F:56:20:1E:AA:78:C0:91:AD:3B:23:AF:4E:68:23:A4:C6:8F:CF:15:10:79:8F:9D:AF:36:3B:8E:5E:60:67:AE:50:CC:78:63:9C:58:E5'
      },
      {
        algorithm: 'sha-512',
        value: '5A:37:2F:11:2E:C6:FF:6C:5D:7A:BF:83:DD:61:CE:7C:41:9C:B6:49:E7:8D:11:C4:AC:1C:9F:12:A3:73:5A:30:A4:E8:55:D2:54:E7:AA:94:2D:DB:50:DF:16:99:AD:33:CD:25:51:BF:E9:66:97:2F:79:B0:7C:5E:BD:14:8F:67'
      },
      [length]: 5
    ],
    role: 'auto'
  }
}
socket::message [jsonMessage:{
  action: 'connect-transport',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3',
  transportId: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  dtlsParameters: {
    role: 'server',
    fingerprints: [
      {
        algorithm: 'sha-256',
        value: '17:8D:6F:95:97:E2:C6:6D:A7:FC:5A:1F:C1:27:C9:16:5A:BC:A7:15:83:6F:C0:59:53:5E:4D:15:9D:DF:BC:47'
      },
      [length]: 1
    ]
  }
}]
handleTransportConnectRequest() transport connected
sending response { action: 'connect-transport' }
socket::message [jsonMessage:{
  action: 'produce',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3',
  transportId: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  kind: 'video',
  rtpParameters: {
    mid: '0',
    codecs: [
      {
        mimeType: 'video/VP8',
        clockRate: 90000,
        payloadType: 96,
        rtcpFeedback: [
          [Object],
          [Object],
          [Object],
          [Object],
          [Object],
          [length]: 5
        ],
        parameters: {}
      },
      {
        mimeType: 'video/rtx',
        clockRate: 90000,
        payloadType: 97,
        rtcpFeedback: [ [length]: 0 ],
        parameters: { apt: 96 }
      },
      [length]: 2
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id', id: 5 },
      {
        uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
        id: 6
      },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      {
        uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
        id: 8
      },
      { uri: 'urn:3gpp:video-orientation', id: 13 },
      { uri: 'urn:ietf:params:rtp-hdrext:toffset', id: 14 },
      [length]: 8
    ],
    encodings: [ { ssrc: 3880737208, rtx: { ssrc: 2905964944 } }, [length]: 1 ],
    rtcp: { cname: 'tmaDD6IYjTa4i8i0' }
  }
}]
handleProduceRequest [data:{
  action: 'produce',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3',
  transportId: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  kind: 'video',
  rtpParameters: {
    mid: '0',
    codecs: [
      {
        mimeType: 'video/VP8',
        clockRate: 90000,
        payloadType: 96,
        rtcpFeedback: [
          [Object],
          [Object],
          [Object],
          [Object],
          [Object],
          [length]: 5
        ],
        parameters: {}
      },
      {
        mimeType: 'video/rtx',
        clockRate: 90000,
        payloadType: 97,
        rtcpFeedback: [ [length]: 0 ],
        parameters: { apt: 96 }
      },
      [length]: 2
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id', id: 5 },
      {
        uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
        id: 6
      },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      {
        uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
        id: 8
      },
      { uri: 'urn:3gpp:video-orientation', id: 13 },
      { uri: 'urn:ietf:params:rtp-hdrext:toffset', id: 14 },
      [length]: 8
    ],
    encodings: [ { ssrc: 3880737208, rtx: { ssrc: 2905964944 } }, [length]: 1 ],
    rtcp: { cname: 'tmaDD6IYjTa4i8i0' }
  }
}]
handleProducerRequest() new producer added [id:53fb6285-02b1-4416-8820-d167e89047e0, kind:video]
sending response {
  action: 'produce',
  id: '53fb6285-02b1-4416-8820-d167e89047e0',
  kind: 'video'
}
socket::message [jsonMessage:{
  action: 'produce',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3',
  transportId: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  kind: 'audio',
  rtpParameters: {
    mid: '1',
    codecs: [
      {
        mimeType: 'audio/opus',
        clockRate: 48000,
        payloadType: 111,
        channels: 2,
        rtcpFeedback: [ [Object], [length]: 1 ],
        parameters: { minptime: 10, useinbandfec: 1 }
      },
      [length]: 1
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      { uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level', id: 1 },
      [length]: 4
    ],
    encodings: [ { ssrc: 2022559690 }, [length]: 1 ],
    rtcp: { cname: 'tmaDD6IYjTa4i8i0' }
  }
}]
handleProduceRequest [data:{
  action: 'produce',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3',
  transportId: '41f814fa-e6d8-4a48-bd41-3174001b1c7a',
  kind: 'audio',
  rtpParameters: {
    mid: '1',
    codecs: [
      {
        mimeType: 'audio/opus',
        clockRate: 48000,
        payloadType: 111,
        channels: 2,
        rtcpFeedback: [ [Object], [length]: 1 ],
        parameters: { minptime: 10, useinbandfec: 1 }
      },
      [length]: 1
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      { uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level', id: 1 },
      [length]: 4
    ],
    encodings: [ { ssrc: 2022559690 }, [length]: 1 ],
    rtcp: { cname: 'tmaDD6IYjTa4i8i0' }
  }
}]
handleProducerRequest() new producer added [id:882f8a47-8fc5-44ed-87b0-596b029e0aca, kind:audio]
sending response {
  action: 'produce',
  id: '882f8a47-8fc5-44ed-87b0-596b029e0aca',
  kind: 'audio'
}
socket::message [jsonMessage:{
  action: 'start-record',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3'
}]
handleStartRecordRequest() [data:{
  action: 'start-record',
  sessionId: '02627dd0-cad7-11ea-8445-a54ebcc8e2b3'
}]
publishProducerRtpStream()
createTransport() [type:plain. options:{ listenIp: '127.0.0.1', rtcpMux: true, comedia: false }]
publishProducerRtpStream()
createTransport() [type:plain. options:{ listenIp: '127.0.0.1', rtcpMux: true, comedia: false }]
createProcess() [sdpString:v=0
  o=- 0 0 IN IP4 127.0.0.1
  s=FFmpeg
  c=IN IP4 127.0.0.1
  t=0 0
  m=video 24926 RTP/AVP 101 
  a=rtpmap:101 VP8/90000
  a=sendonly
  m=audio 22331 RTP/AVP 100 
  a=rtpmap:100 opus/48000/2
  a=sendonly
  ]
commandArgs:[
  '-loglevel',
  'debug',
  '-protocol_whitelist',
  'pipe,udp,rtp',
  '-fflags',
  '+genpts',
  '-f',
  'sdp',
  '-i',
  'pipe:0',
  '-map',
  '0:v:0',
  '-c:v',
  'copy',
  '-map',
  '0:a:0',
  '-strict',
  '-2',
  '-c:a',
  'copy',
  '-flags',
  '+global_header',
  './files/1595283541969.webm',
  [length]: 23
]
ffmpeg::process::data [data:'ffmpeg version N-98498-gfa8345c']
ffmpeg::process::data [data:' Copyright (c) 2000-2020 the FFmpeg developers']
ffmpeg::process::data [data:'\n']
ffmpeg::process::data [data:'  built with gcc 8 (Debian 8.3.0-6)\n']
ffmpeg::process::data [data:"  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libsrt\n"]
ffmpeg::process::data [data:'  libavutil      56. 55.100 / 56. 55.100\n']
ffmpeg::process::data [data:'  libavcodec     58. 96.100 / 58. 96.100\n']
ffmpeg::process::data [data:'  libavformat    58. 48.100 / 58. 48.100\n']
ffmpeg::process::data [data:'  libavdevice    58. 11.101 / 58. 11.101\n']
ffmpeg::process::data [data:'  libavfilter     7. 87.100 /  7. 87.100\n']
ffmpeg::process::data [data:'  libswscale      5.  8.100 /  5.  8.100\n']
ffmpeg::process::data [data:'  libswresample   3.  8.100 /  3.  8.100\n']
ffmpeg::process::data [data:'  libpostproc    55.  8.100 / 55.  8.100\n']
ffmpeg::process::data [data:'Splitting the commandline.\n']
ffmpeg::process::data [data:"Reading option '-loglevel' ..."]
ffmpeg::process::data [data:" matched as option 'loglevel' (set logging level) with argument 'debug'.\n"]
ffmpeg::process::data [data:"Reading option '-protocol_whitelist' ..."]
ffmpeg::process::data [data:" matched as AVOption 'protocol_whitelist' with argument 'pipe,udp,rtp'.\n"]
ffmpeg::process::data [data:"Reading option '-fflags' ..."]
ffmpeg::process::data [data:" matched as AVOption 'fflags' with argument '+genpts'.\n"]
ffmpeg::process::data [data:"Reading option '-f' ..."]
ffmpeg::process::data [data:" matched as option 'f' (force format) with argument 'sdp'.\n"]
ffmpeg::process::data [data:"Reading option '-i' ..."]
ffmpeg::process::data [data:" matched as input url with argument 'pipe:0'.\n"]
ffmpeg::process::data [data:"Reading option '-map' ..."]
ffmpeg::process::data [data:" matched as option 'map' (set input stream mapping) with argument '0:v:0'.\n"]
ffmpeg::process::data [data:"Reading option '-c:v' ..."]
ffmpeg::process::data [data:" matched as option 'c' (codec name) with argument 'copy'.\n"]
ffmpeg::process::data [data:"Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'.\n" +
  "Reading option '-strict' ...Routing option strict to both codec and muxer layer\n" +
  " matched as AVOption 'strict' with argument '-2'.\n" +
  "Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.\n" +
  "Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.\n" +
  "Reading option './files/1595283541969.webm' ... matched as output url.\n" +
  'Finished splitting the commandline.\n' +
  'Parsing a group of options: global .\n' +
  'Applying option loglevel (set logging level) with argument debug.\n' +
  'Successfully parsed a group of options.\n' +
  'Parsing a group of options: input url pipe:0.\n' +
  'Applying option f (force format) with argument sdp.\n' +
  'Successfully parsed a group of options.\n' +
  'Opening an input file: pipe:0.\n' +
  "[sdp @ 0x55919b00a2c0] Opening 'pipe:0' for reading\n"]
ffmpeg::process::data [data:'[sdp @ 0x55919b00a2c0] video codec set to: vp8\n' +
  '[sdp @ 0x55919b00a2c0] audio codec set to: opus\n' +
  '[sdp @ 0x55919b00a2c0] audio samplerate set to: 48000\n' +
  '[sdp @ 0x55919b00a2c0] audio channels set to: 2\n']
ffmpeg::process::data [data:'[udp @ 0x55919b012880] ']
ffmpeg::process::data [data:'end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[udp @ 0x55919b0121c0] ']
ffmpeg::process::data [data:'end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[sdp @ 0x55919b00a2c0] setting jitter buffer size to 500\n' +
  '[udp @ 0x55919b00ba40] end receive buffer size reported is 425984\n' +
  '[udp @ 0x55919b00b280] end receive buffer size reported is 425984\n' +
  '[sdp @ 0x55919b00a2c0] setting jitter buffer size to 500\n']
ffmpeg::process::data [data:'[sdp @ 0x55919b00a2c0] ']
ffmpeg::process::data [data:'Before avformat_find_stream_info() pos: 210 bytes read:210 seeks:0 nb_streams:2\n']
ffmpeg::process::data [data:'[sdp @ 0x55919b00a2c0] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\n' +
  "Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options\n" +
  '[sdp @ 0x55919b00a2c0] After avformat_find_stream_info() pos: 210 bytes read:210 seeks:0 frames:0\n' +
  "Input #0, sdp, from 'pipe:0':\n" +
  '  Metadata:\n' +
  '    title           : FFmpeg\n' +
  '  Duration: N/A, bitrate: N/A\n' +
  '    Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc\n' +
  '    Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp\n' +
  'Successfully opened the file.\n' +
  'Parsing a group of options: output url ./files/1595283541969.webm.\n' +
  'Applying option map (set input stream mapping) with argument 0:v:0.\n' +
  'Applying option c:v (codec name) with argument copy.\n' +
  'Applying option map (set input stream mapping) with argument 0:a:0.\n' +
  'Applying option c:a (codec name) with argument copy.\n' +
  'Successfully parsed a group of options.\n' +
  'Opening an output file: ./files/1595283541969.webm.\n' +
  "[file @ 0x55919b00b740] Setting default whitelist 'file,crypto,data'\n"]
ffmpeg::process::data [data:'Successfully opened the file.\n' +
  '[webm @ 0x55919b01a7c0] dimensions not set\n' +
  'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\n' +
  'Stream mapping:\n' +
  '  Stream #0:0 -> #0:0 (copy)\n' +
  '  Stream #0:1 -> #0:1 (copy)\n' +
  '    Last message repeated 1 times\n' +
  '[AVIOContext @ 0x55919b00e800] Statistics: 0 seeks, 0 writeouts\n' +
  '[AVIOContext @ 0x55919b013140] Statistics: 210 bytes read, 0 seeks\n']
ffmpeg::process::close

And my last attempt with updated sdp payloads and probsize:

mediasoup loaded [version:3.4.8]
starting server [processName:FFmpeg]
initializeWorkers() creating 1 mediasoup workers
createRouter() creating new router [worker.pid:14257]
Socket Server listening on port 3000
new socket connection [iphttps://rfst.ru]
socket::message [jsonMessage:{
  action: 'create-transport',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4'
}]
createTransport() [type:webRtc. options:undefined]
sending response {
  action: 'create-transport',
  id: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  iceParameters: {
    iceLite: true,
    password: 'hfgaoylmfcznreofu8d3tvq7wtsogbhk',
    usernameFragment: 'smj9bps1iveemlru'
  },
  iceCandidates: [
    {
      foundation: 'udpcandidate',
      ip: '127.0.0.1',
      port: 46351,
      priority: 1076558079,
      protocol: 'udp',
      type: 'host'
    },
    {
      foundation: 'tcpcandidate',
      ip: '127.0.0.1',
      port: 40914,
      priority: 1076302079,
      protocol: 'tcp',
      tcpType: 'passive',
      type: 'host'
    },
    [length]: 2
  ],
  dtlsParameters: {
    fingerprints: [
      {
        algorithm: 'sha-1',
        value: 'F2:E6:C1:85:91:FF:59:22:54:5F:09:EA:A6:20:94:9F:93:D7:C6:DB'
      },
      {
        algorithm: 'sha-224',
        value: 'EC:8F:FD:9E:DB:CF:10:BA:22:F1:88:C3:F1:8B:70:2B:7B:5C:32:1A:12:CC:1C:BA:D5:50:5D:63'
      },
      {
        algorithm: 'sha-256',
        value: 'BE:BE:2C:0B:B1:D5:FA:92:6D:87:F0:AB:7C:7F:3C:EB:6A:48:44:24:61:63:96:15:55:08:F2:43:F2:22:E8:1A'
      },
      {
        algorithm: 'sha-384',
        value: '41:43:F7:DA:25:4A:0E:BC:53:13:98:D6:B5:14:95:75:B8:4A:13:64:30:6E:3A:AC:27:EB:73:4C:FA:C7:48:9B:A2:20:5C:78:90:BE:FD:46:2E:1E:9A:A7:8F:E8:53:BF'
      },
      {
        algorithm: 'sha-512',
        value: '01:77:FD:4F:DD:D4:D6:FA:59:ED:4C:42:72:96:31:33:56:09:84:CC:7A:88:3D:9C:61:E2:62:C3:99:CA:D2:55:ED:43:47:BE:D8:EB:6F:70:C0:03:CA:E8:36:A8:BE:12:FD:8C:BD:51:80:50:94:5F:1C:78:B0:2A:5A:D9:BF:42'
      },
      [length]: 5
    ],
    role: 'auto'
  }
}
socket::message [jsonMessage:{
  action: 'connect-transport',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4',
  transportId: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  dtlsParameters: {
    role: 'server',
    fingerprints: [
      {
        algorithm: 'sha-256',
        value: '98:E2:F0:44:66:8D:11:C8:58:CD:15:2A:9B:86:81:06:AF:06:73:D4:56:31:EB:DF:A5:DC:B5:71:FE:F1:6C:10'
      },
      [length]: 1
    ]
  }
}]
handleTransportConnectRequest() transport connected
sending response { action: 'connect-transport' }
socket::message [jsonMessage:{
  action: 'produce',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4',
  transportId: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  kind: 'video',
  rtpParameters: {
    mid: '0',
    codecs: [
      {
        mimeType: 'video/VP8',
        clockRate: 90000,
        payloadType: 96,
        rtcpFeedback: [
          [Object],
          [Object],
          [Object],
          [Object],
          [Object],
          [length]: 5
        ],
        parameters: {}
      },
      {
        mimeType: 'video/rtx',
        clockRate: 90000,
        payloadType: 97,
        rtcpFeedback: [ [length]: 0 ],
        parameters: { apt: 96 }
      },
      [length]: 2
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id', id: 5 },
      {
        uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
        id: 6
      },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      {
        uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
        id: 8
      },
      { uri: 'urn:3gpp:video-orientation', id: 13 },
      { uri: 'urn:ietf:params:rtp-hdrext:toffset', id: 14 },
      [length]: 8
    ],
    encodings: [ { ssrc: 3422368717, rtx: { ssrc: 1248174812 } }, [length]: 1 ],
    rtcp: { cname: 'KWHzQBAZoPomWZHo' }
  }
}]
handleProduceRequest [data:{
  action: 'produce',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4',
  transportId: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  kind: 'video',
  rtpParameters: {
    mid: '0',
    codecs: [
      {
        mimeType: 'video/VP8',
        clockRate: 90000,
        payloadType: 96,
        rtcpFeedback: [
          [Object],
          [Object],
          [Object],
          [Object],
          [Object],
          [length]: 5
        ],
        parameters: {}
      },
      {
        mimeType: 'video/rtx',
        clockRate: 90000,
        payloadType: 97,
        rtcpFeedback: [ [length]: 0 ],
        parameters: { apt: 96 }
      },
      [length]: 2
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id', id: 5 },
      {
        uri: 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
        id: 6
      },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      {
        uri: 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07',
        id: 8
      },
      { uri: 'urn:3gpp:video-orientation', id: 13 },
      { uri: 'urn:ietf:params:rtp-hdrext:toffset', id: 14 },
      [length]: 8
    ],
    encodings: [ { ssrc: 3422368717, rtx: { ssrc: 1248174812 } }, [length]: 1 ],
    rtcp: { cname: 'KWHzQBAZoPomWZHo' }
  }
}]
handleProducerRequest() new producer added [id:45315cd7-ed5b-4148-ba99-14a53770e22b, kind:video]
sending response {
  action: 'produce',
  id: '45315cd7-ed5b-4148-ba99-14a53770e22b',
  kind: 'video'
}
socket::message [jsonMessage:{
  action: 'produce',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4',
  transportId: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  kind: 'audio',
  rtpParameters: {
    mid: '1',
    codecs: [
      {
        mimeType: 'audio/opus',
        clockRate: 48000,
        payloadType: 111,
        channels: 2,
        rtcpFeedback: [ [Object], [length]: 1 ],
        parameters: { minptime: 10, useinbandfec: 1 }
      },
      [length]: 1
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      { uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level', id: 1 },
      [length]: 4
    ],
    encodings: [ { ssrc: 3712966569 }, [length]: 1 ],
    rtcp: { cname: 'KWHzQBAZoPomWZHo' }
  }
}]
handleProduceRequest [data:{
  action: 'produce',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4',
  transportId: '31c07c55-98d3-43c4-b516-162c38e6bc87',
  kind: 'audio',
  rtpParameters: {
    mid: '1',
    codecs: [
      {
        mimeType: 'audio/opus',
        clockRate: 48000,
        payloadType: 111,
        channels: 2,
        rtcpFeedback: [ [Object], [length]: 1 ],
        parameters: { minptime: 10, useinbandfec: 1 }
      },
      [length]: 1
    ],
    headerExtensions: [
      { uri: 'urn:ietf:params:rtp-hdrext:sdes:mid', id: 4 },
      {
        uri: 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
        id: 2
      },
      {
        uri: 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
        id: 3
      },
      { uri: 'urn:ietf:params:rtp-hdrext:ssrc-audio-level', id: 1 },
      [length]: 4
    ],
    encodings: [ { ssrc: 3712966569 }, [length]: 1 ],
    rtcp: { cname: 'KWHzQBAZoPomWZHo' }
  }
}]
handleProducerRequest() new producer added [id:33aa0313-1915-4da8-9454-bc5076af5d12, kind:audio]
sending response {
  action: 'produce',
  id: '33aa0313-1915-4da8-9454-bc5076af5d12',
  kind: 'audio'
}
socket::message [jsonMessage:{
  action: 'start-record',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4'
}]
handleStartRecordRequest() [data:{
  action: 'start-record',
  sessionId: 'd8bfcf90-cad7-11ea-bb21-6390f2f289b4'
}]
publishProducerRtpStream()
createTransport() [type:plain. options:{ listenIp: '127.0.0.1', rtcpMux: true, comedia: false }]
publishProducerRtpStream()
createTransport() [type:plain. options:{ listenIp: '127.0.0.1', rtcpMux: true, comedia: false }]
createProcess() [sdpString:v=0
  o=- 0 0 IN IP4 127.0.0.1
  s=FFmpeg
  c=IN IP4 127.0.0.1
  t=0 0
  m=video 20587 RTP/AVP 96
  a=rtpmap:96 VP8/90000
  a=sendonly
  m=audio 27052 RTP/AVP 111
  a=rtpmap:111 opus/48000/2
  a=sendonly
  ]
commandArgs:[
  '-analyzeduration',
  '5M',
  '-probesize',
  '5M',
  '-loglevel',
  'debug',
  '-protocol_whitelist',
  'pipe,udp,rtp',
  '-fflags',
  '+genpts',
  '-f',
  'sdp',
  '-i',
  'pipe:0',
  '-map',
  '0:v:0',
  '-c:v',
  'copy',
  '-map',
  '0:a:0',
  '-strict',
  '-2',
  '-c:a',
  'copy',
  '-flags',
  '+global_header',
  './files/1595283901572.webm',
  [length]: 27
]
ffmpeg::process::data [data:'ffmpeg version N-98498-gfa8345c']
ffmpeg::process::data [data:' Copyright (c) 2000-2020 the FFmpeg developers']
ffmpeg::process::data [data:'\n']
ffmpeg::process::data [data:'  built with gcc 8 (Debian 8.3.0-6)\n']
ffmpeg::process::data [data:"  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libsrt\n"]
ffmpeg::process::data [data:'  libavutil      56. 55.100 / 56. 55.100\n']
ffmpeg::process::data [data:'  libavcodec     58. 96.100 / 58. 96.100\n']
ffmpeg::process::data [data:'  libavformat    58. 48.100 / 58. 48.100\n']
ffmpeg::process::data [data:'  libavdevice    58. 11.101 / 58. 11.101\n']
ffmpeg::process::data [data:'  libavfilter     7. 87.100 /  7. 87.100\n']
ffmpeg::process::data [data:'  libswscale      5.  8.100 /  5.  8.100\n']
ffmpeg::process::data [data:'  libswresample   3.  8.100 /  3.  8.100\n']
ffmpeg::process::data [data:'  libpostproc    55.  8.100 / 55.  8.100\n']
ffmpeg::process::data [data:'Splitting the commandline.\n']
ffmpeg::process::data [data:"Reading option '-analyzeduration' ..."]
ffmpeg::process::data [data:" matched as AVOption 'analyzeduration' with argument '5M'.\n"]
ffmpeg::process::data [data:"Reading option '-probesize' ..."]
ffmpeg::process::data [data:" matched as AVOption 'probesize' with argument '5M'.\n"]
ffmpeg::process::data [data:"Reading option '-loglevel' ..."]
ffmpeg::process::data [data:" matched as option 'loglevel' (set logging level) with argument 'debug'.\n"]
ffmpeg::process::data [data:"Reading option '-protocol_whitelist' ..."]
ffmpeg::process::data [data:" matched as AVOption 'protocol_whitelist' with argument 'pipe,udp,rtp'.\n"]
ffmpeg::process::data [data:"Reading option '-fflags' ..."]
ffmpeg::process::data [data:" matched as AVOption 'fflags' with argument '+genpts'.\n"]
ffmpeg::process::data [data:"Reading option '-f' ..."]
ffmpeg::process::data [data:" matched as option 'f' (force format) with argument 'sdp'.\n"]
ffmpeg::process::data [data:"Reading option '-i' ..."]
ffmpeg::process::data [data:" matched as input url with argument 'pipe:0'.\n"]
ffmpeg::process::data [data:"Reading option '-map' ..."]
ffmpeg::process::data [data:" matched as option 'map' (set input stream mapping) with argument '0:v:0'.\n"]
ffmpeg::process::data [data:"Reading option '-c:v' ..."]
ffmpeg::process::data [data:" matched as option 'c' (codec name) with argument 'copy'.\n"]
ffmpeg::process::data [data:"Reading option '-map' ..."]
ffmpeg::process::data [data:" matched as option 'map' (set input stream mapping) with argument '0:a:0'.\n"]
ffmpeg::process::data [data:"Reading option '-strict' ..."]
ffmpeg::process::data [data:'Routing option strict to both codec and muxer layer\n']
ffmpeg::process::data [data:" matched as AVOption 'strict' with argument '-2'.\n"]
ffmpeg::process::data [data:"Reading option '-c:a' ..."]
ffmpeg::process::data [data:" matched as option 'c' (codec name) with argument 'copy'.\n"]
ffmpeg::process::data [data:"Reading option '-flags' ..."]
ffmpeg::process::data [data:" matched as AVOption 'flags' with argument '+global_header'.\n"]
ffmpeg::process::data [data:"Reading option './files/1595283901572.webm' ..."]
ffmpeg::process::data [data:' matched as output url.\n']
ffmpeg::process::data [data:'Finished splitting the commandline.\n']
ffmpeg::process::data [data:'Parsing a group of options: global .\n']
ffmpeg::process::data [data:'Applying option loglevel (set logging level) with argument debug.\n']
ffmpeg::process::data [data:'Successfully parsed a group of options.\n']
ffmpeg::process::data [data:'Parsing a group of options: input url pipe:0.\n']
ffmpeg::process::data [data:'Applying option f (force format) with argument sdp.\n']
ffmpeg::process::data [data:'Successfully parsed a group of options.\n']
ffmpeg::process::data [data:'Opening an input file: pipe:0.\n']
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] ']
ffmpeg::process::data [data:"Opening 'pipe:0' for reading\n"]
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] ']
ffmpeg::process::data [data:'video codec set to: vp8\n']
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] ']
ffmpeg::process::data [data:'audio codec set to: opus\n' +
  '[sdp @ 0x5622cb89a2c0] audio samplerate set to: 48000\n' +
  '[sdp @ 0x5622cb89a2c0] audio channels set to: 2\n' +
  '[udp @ 0x5622cb8a2c80] end receive buffer size reported is 425984\n' +
  '[udp @ 0x5622cb8a25c0] end receive buffer size reported is 425984\n' +
  '[sdp @ 0x5622cb89a2c0] setting jitter buffer size to 500\n']
ffmpeg::process::data [data:'[udp @ 0x5622cb89bc80] ']
ffmpeg::process::data [data:'end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[udp @ 0x5622cb89b780] ']
ffmpeg::process::data [data:'end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] ']
ffmpeg::process::data [data:'setting jitter buffer size to 500\n']
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] Before avformat_find_stream_info() pos: 206 bytes read:206 seeks:0 nb_streams:2\n']
ffmpeg::process::data [data:'[sdp @ 0x5622cb89a2c0] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\n' +
  "Consider increasing the value for the 'analyzeduration' (5000000) and 'probesize' (5000000) options\n" +
  '[sdp @ 0x5622cb89a2c0] After avformat_find_stream_info() pos: 206 bytes read:206 seeks:0 frames:0\n' +
  "Input #0, sdp, from 'pipe:0':\n" +
  '  Metadata:\n' +
  '    title           : FFmpeg\n' +
  '  Duration: N/A, bitrate: N/A\n' +
  '    Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc\n' +
  '    Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp\n' +
  'Successfully opened the file.\n' +
  'Parsing a group of options: output url ./files/1595283901572.webm.\n' +
  'Applying option map (set input stream mapping) with argument 0:v:0.\n' +
  'Applying option c:v (codec name) with argument copy.\n' +
  'Applying option map (set input stream mapping) with argument 0:a:0.\n' +
  'Applying option c:a (codec name) with argument copy.\n' +
  'Successfully parsed a group of options.\n' +
  'Opening an output file: ./files/1595283901572.webm.\n' +
  "[file @ 0x5622cb8a6940] Setting default whitelist 'file,crypto,data'\n" +
  'Successfully opened the file.\n' +
  '[webm @ 0x5622cb8aad40] dimensions not set\n' +
  'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\n' +
  'Stream mapping:\n' +
  '  Stream #0:0 -> #0:0 (copy)\n' +
  '  Stream #0:1 -> #0:1 (copy)\n' +
  '    Last message repeated 1 times\n' +
  '[AVIOContext @ 0x5622cb89b940] Statistics: 0 seeks, 0 writeouts\n' +
  '[AVIOContext @ 0x5622cb8a3600] Statistics: 206 bytes read, 0 seeks\n']
ffmpeg::process::close

ffmpeg file dump fails

When the stderr and stdout hooks of a process are commented out, the ffmpeg process seems to be failing.
Have you ever come across this?

It creates a small file of 600 bytes without any content.

FFMPEG process with piped streams

Hi Ethan,
I have attempted to consume piped streams and create a new webm file similar to your implementation.

I pipe audio and video streams, to a different server, and create two consumer objects. This step works successfully.

But when I begin an ffmpeg process with these consumers, it always enters stderr hook of the process and prints the ffmpeg banner.
It doesn't seem to start recording.

Did you face something like this? Can you tell me if I'm doing something wrong?

How can I just use FFmpeg command in terminal to record?

Hello!
I tried to use FFmpeg command in terminal to recoed, so that I can record in another computer.I changed code so that node won't start FFmpeg process after everything was OK,then I save sdp string named "1.sdp",finally,I use command "ffmpeg --protocol_whitelist "file,udp,rtp" -i 1.sdp -acodec copy -vcodec copy out.webm",but I just got a video which was always black and without sound.I also tried to add parameters which was in the "ffmpeg.js",but it didn't work.
I refered to the information on the Internet,many blogs said that "ffmpeg --protocol_whitelist "file,udp,rtp" -i 1.sdp" will work,but the truth was not so.

isPortOpen from port.js is broken

isPortOpen() is broken, ex. socket is undefined.
But apart from this, there is a logic problem. resolve would actually mean that port is "busy", and reject would mean that the port is free and can be used by the script.

it Doesn't support codec h264

Hi!
I need to use h264, but vp8 is default in this project...
How Can I change it? I need to do live streaming to Youtube live and it doesn't support vp8

'simulcast' - ffmpeg/gstreamer record lowest stream

After applying this patch, ffmpeg as well as gstreamer record the scaleResolutionDownBy: 4 stream:

diff -r app-orig/src/gum.js app/src/gum.js
<   video: { width: 640, height: 480 }
---
>   video: { width: 1280, height: 720 }

diff -r app-orig/src/index.js app/src/index.js
<     const videoProducer = await peer.sendTransport.produce({ track: videoTrack });
---
>     const videoProducer = await peer.sendTransport.produce({ track: videoTrack,
>         encodings: [
>             { maxBitrate:  96000, scaleResolutionDownBy: 4 },
>             { maxBitrate: 680000, scaleResolutionDownBy: 1 },
>         ] });

Multiple codec support

Currently the config has multiple codecs, but the file name/ffmpeg/gstreamer args do not support this.

Tiling several feeds?

Not a bug but a question: would it be feasible to send ffmpeg or gstreamer not one but several incoming feeds and let them tile the result (mixing the audio, and tiling visually the video tracks)? This way we could produce recordings to file that contain video of several browser webcams!

useful for educational purposes.

Websocket connection failing

I try to open localhost:8080 and there is websocket connection fail in chrome console:
index.js:12 WebSocket connection to 'wss://localhost:3000/' failed
The server is started and there is Socket Server listening on port 3000 message.
I have changed websocket port, allowed unsecure connection in chrome site settings but nothing works.
May be this is relevant, I have the same error when trying open official mediasoud demo page https://v3demo.mediasoup.org

Documentation missing Server ENV option

The README is missing an important Server ENV parameter:

SERVER_PORT---->Integer---->The server port number you wish to use. Please note the default is port 3000
Please note if you update this parameter the app must also be updated with the new port
Please modify the index.js file websocket address with the new port number:
const socket = new WebSocket(wss://${window.location.hostname}:[NEW PORT NUMBER]);

stop recorder throws exception, I am starting the server with gstream

w.r.t to https://github.com/ethand91/mediasoup3-record-demo codebase

at server on stoprecorder gives the following error with node14 lts verstion

socket::message [jsonMessage:{
action: 'start-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
handleStartRecordRequest() [data:{
action: 'start-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
publishProducerRtpStream()
createTransport() [type:plain. options:{
listenIp: { ip: '0.0.0.0', announcedIp: undefined },
rtcpMux: false,
comedia: false
}]
(node:23840) UnhandledPromiseRejectionWarning: UnsupportedError: no compatible media codecs
at Object.getConsumerRtpParameters (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/mediasoup/lib/ortc.js:690:15)
at PlainTransport.consume (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/mediasoup/lib/Transport.js:290:36)
at publishProducerRtpStream (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:250:42)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async startRecord (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:271:33)
(node:23840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)
socket::message [jsonMessage:{
action: 'stop-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
handleStopRecordRequest() [data:{
action: 'stop-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
Failed to handle socket message [error:Error: Peer with id bf620610-905e-11eb-93ec-09b099635e86 is not recording
at handleStopRecordRequest (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:190:11)
at handleJsonMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:99:20)
at WebSocket. (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:63:30)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/websocket.js:825:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:437:14)
at Receiver.getData (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:367:17)
at Receiver.startLoop (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:143:22)
at Receiver._write (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:78:10) {
[stack]: 'Error: Peer with id bf620610-905e-11eb-93ec-09b099635e86 is not recording\n' +
' at handleStopRecordRequest (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:190:11)\n' +
' at handleJsonMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:99:20)\n' +
' at WebSocket. (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/src/server.js:63:30)\n' +
' at WebSocket.emit (events.js:315:20)\n' +
' at Receiver.receiverOnMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/websocket.js:825:20)\n' +
' at Receiver.emit (events.js:315:20)\n' +
' at Receiver.dataMessage (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:437:14)\n' +
' at Receiver.getData (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:367:17)\n' +
' at Receiver.startLoop (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:143:22)\n' +
' at Receiver._write (/home/nagkumar/nag/fork/mediasoup3-record-demo/server/node_modules/ws/lib/receiver.js:78:10)',
[message]: 'Peer with id bf620610-905e-11eb-93ec-09b099635e86 is not recording'
}]
socket::message [jsonMessage:{
action: 'start-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
handleStartRecordRequest() [data:{
action: 'start-record',
sessionId: 'bf620610-905e-11eb-93ec-09b099635e86'
}]
publishProducerRtpStream()
createTransport() [type:plain. options:{
listenIp: { ip: '0.0.0.0', announcedIp: undefined },
rtcpMux: false,
comedia: false
}]

How can I record in another computer instead of the computer which the medaisoup server is running?

Hello!
I changed some codes,and saved sdp as a document named "1.sdp",then I tried to ues FFmpeg command "ffmpeg -protocol_whitelist "file,udp,rtp" -i 1.sdp -acodec copy -vcodec copy out.webm" to record.I got the correct video in the computer which the server was running, but I couldn't get anything in another computer with the same command.
I thought maybe ffmpeg command was wrong,so I changed code so that I can run code to record in another computer,but it didn't work.It also worked well in the computer which the server was running.
All in all,I just want to record video in another computer.
This is my sdp:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFmpeg
c=IN IP4 10.113.121.146
t=0 0
m=video 10002 RTP/AVP 101
a=rtpmap:101 VP8/90000
a=sendonly
m=audio 10000 RTP/AVP 100
a=rtpmap:100 opus/48000/2
a=sendonly

After running a while,the ffmpeg process will close,the wrong infomation is as the same as running with sdp whose ip is wrong.
This is log:
ffmpeg::process::data [data:'ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers\n' +
' built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)\n' +
' configuration: --enable-libvpx --enable-libopus --enable-libvorbis --disable-x86asm\n' +
' libavutil 56. 51.100 / 56. 51.100\n' +
' libavcodec 58. 91.100 / 58. 91.100\n' +
' libavformat 58. 45.100 / 58. 45.100\n' +
' libavdevice 58. 10.100 / 58. 10.100\n' +
' libavfilter 7. 85.100 / 7. 85.100\n' +
' libswscale 5. 7.100 / 5. 7.100\n' +
' libswresample 3. 7.100 / 3. 7.100\n' +
'Splitting the commandline.\n' +
"Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.\n" +
"Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.\n" +
"Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'pipe,udp,rtp'.\n" +
"Reading option '-fflags' ..."]
ffmpeg::process::data [data:" matched as AVOption 'fflags' with argument '+genpts'.\n" +
"Reading option '-f' ... matched as option 'f' (force format) with argument 'sdp'.\n" +
"Reading option '-i' ... matched as input url with argument 'pipe:0'.\n" +
"Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v:0'.\n" +
"Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.\n" +
"Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'.\n" +
"Reading option '-strict' ..."]
ffmpeg::process::data [data:'Routing option strict to both codec and muxer layer\n' +
" matched as AVOption 'strict' with argument '-2'.\n" +
"Reading option '-c:a' ..."]
ffmpeg::process::data [data:" matched as option 'c' (codec name) with argument 'copy'.\n" +
"Reading option '-flags' ..."]
ffmpeg::process::data [data:" matched as AVOption 'flags' with argument '+global_header'.\n" +
"Reading option '../files/1.webm' ..."]
ffmpeg::process::data [data:' matched as output url.\n' +
'Finished splitting the commandline.\n' +
'Parsing a group of options: global .\n' +
'Applying option loglevel (set logging level) with argument debug.\n' +
'Successfully parsed a group of options.\n' +
'Parsing a group of options: input url pipe:0.\n' +
'Applying option re (read input at native frame rate) with argument 1.\n' +
'Applying option f (force format) with argument sdp.\n' +
'Successfully parsed a group of options.\n' +
'Opening an input file: pipe:0.\n']
ffmpeg::process::data [data:"[sdp @ 0x55ed988cfac0] Opening 'pipe:0' for reading\n"]
ffmpeg::process::data [data:'[sdp @ 0x55ed988cfac0] video codec set to: vp8\n']
ffmpeg::process::data [data:'[sdp @ 0x55ed988cfac0] audio codec set to: opus\n' +
'[sdp @ 0x55ed988cfac0] audio samplerate set to: 48000\n' +
'[sdp @ 0x55ed988cfac0] audio channels set to: 2\n']
ffmpeg::process::data [data:'[udp @ 0x55ed988d80c0] end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[udp @ 0x55ed988d79c0] end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[sdp @ 0x55ed988cfac0] setting jitter buffer size to 500\n']
ffmpeg::process::data [data:'[udp @ 0x55ed988d1100] end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[udp @ 0x55ed988d0c40] end receive buffer size reported is 425984\n']
ffmpeg::process::data [data:'[sdp @ 0x55ed988cfac0] setting jitter buffer size to 500\n' +
'[sdp @ 0x55ed988cfac0] Before avformat_find_stream_info() pos: 227 bytes read:227 seeks:0 nb_streams:2\n']
ffmpeg::process::data [data:'[sdp @ 0x55ed988cfac0] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\n' +
"Consider increasing the value for the 'analyzeduration' and 'probesize' options\n" +
'[sdp @ 0x55ed988cfac0] After avformat_find_stream_info() pos: 227 bytes read:227 seeks:0 frames:0\n']
ffmpeg::process::data [data:"Input #0, sdp, from 'pipe:0':\n" +
' Metadata:\n' +
' title : FFmpeg\n' +
' Duration: N/A, bitrate: N/A\n' +
' Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc\n' +
' Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp\n' +
'Successfully opened the file.\n' +
'Parsing a group of options: output url ../files/1.webm.\n' +
'Applying option map (set input stream mapping) with argument 0:v:0.\n' +
'Applying option c:v (codec name) with argument copy.\n' +
'Applying option map (set input stream mapping) with argument 0:a:0.\n' +
'Applying option c:a (codec name) with argument copy.\n' +
'Successfully parsed a group of options.\n' +
'Opening an output file: ../files/1.webm.\n' +
"File '../files/1.webm' already exists. Exiting.\n" +
'[AVIOContext @ 0x55ed988d8ac0] Statistics: 227 bytes read, 0 seeks\n']
ffmpeg::process::close

Issue FFmpeg server start upon start recording

'-flags',
'+global_header',
'./files/1616749230182.webm',
[length]: 23 ]
events.js:174
throw er; // Unhandled 'error' event
^

Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:78:25)
at writeGeneric (internal/stream_base_commons.js:73:3)
at Socket._writeGeneric (net.js:714:5)
at Socket._write (net.js:726:8)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at Socket.Writable.write (_stream_writable.js:299:11)
at Readable.ondata (_stream_readable.js:710:20)
at Readable.emit (events.js:198:13)
at Readable.read (_stream_readable.js:505:10)
Emitted 'error' event at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
at Socket.onerror (_stream_readable.js:734:7)
at Socket.emit (events.js:198:13)
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:430:5)
at onwrite (_stream_writable.js:461:5)
at _destroy (internal/streams/destroy.js:49:7)
at Socket._destroy (net.js:614:3)
at Socket.destroy (internal/streams/destroy.js:37:8)
at afterWriteDispatched (internal/stream_base_commons.js:78:17)

Firefox not recording

I tried to record with Firefox, but it failed recording and recording file is 0 bytes. However recording with chrome is OK.

This is the latest message of ffmpeg:

ffmpeg::process::data [data:'[mp4 @ 0x55ef198365c0] dimensions not set\n' +
  'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\n' +
  'Error initializing output stream 0:1 -- \n' +
  'Stream mapping:\n' +
  '  Stream #0:0 -> #0:0 (copy)\n' +
  '  Stream #0:1 -> #0:1 (copy)\n' +
  '    Last message repeated 1 times\n' +
  '[AVIOContext @ 0x55ef19839bc0] Statistics: 0 seeks, 0 writeouts\n' +
  '[AVIOContext @ 0x55ef197c0380] Statistics: 210 bytes read, 0 seeks\n']
ffmpeg::process::close```

ffmpeg-static": "^4.4.0"
mediasoup": "^3.8.4"
ffmpeg --version : 4.4

any ideas?

Router and multiple workers

I've noticed a strange logic in the code.

You initialize multiple workers in mediasoup.js and have a function to get a next worker in "round-robin" style. However, it looks like on the start of server.js you create one router from the 1st available worker and never try to utilise other workers.

Am I missing something or this is really a bug? Should not you have one router per session?

errors in ffmpeg

Hi, perhaps you can help me understand the cause of the issues I am having?
When streaming from chrome using h264, ffmpeg outputs the following errors

Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x560aaea4a940] concealing 2468 DC, 2468 AC, 2468 MV errors in P frame
pipe:0: corrupt decoded frame in stream 0
[h264 @ 0x560aaeaee1c0] non-existing PPS 31 referenced
[h264 @ 0x560aaeaee1c0] decode_slice_header error

ffmpeg record error

@ethand91
I follow the Readme, the demo works, but the recording file failed.The error info:

ffmpeg::process::data [data:' matched as AVOption \'flags\' with argument \'+global_header\'.\nReading option \'./files/1581048823271.webm\' ... matched as output url.\nFinished splitting the commandline.\nParsing a group of options: global .\nApplying option loglevel (set logging level) with argument debug.\nSuccessfully parsed a group of options.\nParsing a group of options: input url pipe:0.\nApplying option f (force format) with argument sdp.\nSuccessfully parsed a group of options.\nOpening an input file: pipe:0.\n[sdp @ 0x2e827c0] Opening \'pipe:0\' for reading\n']
ffmpeg::process::data [data:'[sdp @ 0x2e827c0] video codec set to: vp8\n[sdp @ 0x2e827c0] audio codec set to: opus\n']
ffmpeg::process::data [data:'[sdp @ 0x2e827c0] audio samplerate set to: 48000\n[sdp @ 0x2e827c0] audio channels set to: 2\n']
ffmpeg::process::data [data:'[udp @ 0x2e8a800] end receive buffer size reported is 131072\n']
ffmpeg::process::data [data:'[udp @ 0x2e89bc0] end receive buffer size reported is 131072\n']
ffmpeg::process::data [data:'[sdp @ 0x2e827c0] setting jitter buffer size to 500\n']
ffmpeg::process::data [data:'[udp @ 0x2e8b280] end receive buffer size reported is 131072\n']
ffmpeg::process::data [data:'[udp @ 0x2e8b100] end receive buffer size reported is 131072\n[sdp @ 0x2e827c0] setting jitter buffer size to 500\n[sdp @ 0x2e827c0] Before avformat_find_stream_info() pos: 207 bytes read:207 seeks:0 nb_streams:2\n']
ffmpeg::process::data [data:'[sdp @ 0x2e827c0] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\nConsider increasing the value for the \'analyzeduration\' and \'probesize\' options\n']
ffmpeg::process::data [data:'[sdp @ 0x2e827c0] After avformat_find_stream_info() pos: 207 bytes read:207 seeks:0 frames:0\nInput #0, sdp, from \'pipe:0\':\n  Metadata:\n    title           : FFmpeg\n  Duration: N/A, bitrate: N/A\n    Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc\n    Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp\nSuccessfully opened the file.\nParsing a group of options: output url ./files/1581048823271.webm.\nApplying option map (set input stream mapping) with argument 0:v:0.\nApplying option c:v (codec name) with argument copy.\nApplying option map (set input stream mapping) with argument 0:a:0.\nApplying option c:a (codec name) with argument copy.\nSuccessfully parsed a group of options.\nOpening an output file: ./files/1581048823271.webm.\n']
ffmpeg::process::data [data:'[file @ 0x2e8fcc0] Setting default whitelist \'file,crypto\'\n']
ffmpeg::process::data [data:'Successfully opened the file.\n']
ffmpeg::process::data [data:'[webm @ 0x2e85180] dimensions not set\n']
ffmpeg::process::data [data:'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\nStream mapping:\n  Stream #0:0 -> #0:0 (copy)\n  Stream #0:1 -> #0:1 (copy)\n    Last message repeated 1 times\n[AVIOContext @ 0x2e8fac0] Statistics: 0 seeks, 0 writeouts\n']
ffmpeg::process::data [data:'[AVIOContext @ 0x2e8b440] Statistics: 207 bytes read, 0 seeks\n']
ffmpeg::process::close

Can you help me?Thanks.

Dropping old packet received too late

Hi Ethan,
When I stop the ffmpeg process and make it listen to the same ports again, it doesn't dump streams initially.
The ffmpeg process prints:
"Dropping old packet received too late"
And it goes on for a while.

Do you know why this happens?

Also is there a way to connect with you, one on one?

Handle getUserMedia errors

For example when the device was not found.

index.js:162 Uncaught (in promise) DOMException: Requested device not found

A bug: GStreamer process doesn't stop when "killed"

When configured with PROCESS_NAME = process.env.PROCESS_NAME || 'FFmpeg'; everything works as expected: the "stop recording" button on the client stops recording and ends the ffmpeg process.
However using 'GStreamer', two processes are created: one the actual gst-launch-1.0, and the other - /bin/sh, apparently due to shell: true in spawn(). When the parent process wants to kill the child, it uses a PID of the shell and the process is not killed, but continues to run.

ffmpeg record error

hi ,i met the error:

ffmpeg::process::data [data:'[sdp @ 0x6b903c0] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\n' +
  "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n" +
  '[sdp @ 0x6b903c0] After avformat_find_stream_info() pos: 208 bytes read:208 seeks:0 frames:0\n']
ffmpeg::process::data [data:"Input #0, sdp, from 'pipe:0':\n" +
  '  Metadata:\n' +
  '    title           : FFmpeg\n' +
  '  Duration: N/A, bitrate: N/A\n' +
  '    Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc\n' +
  '    Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp\n' +
  'Successfully opened the file.\n' +
  'Parsing a group of options: output url /root/recording/files/1585644824875.webm.\n' +
  'Applying option map (set input stream mapping) with argument 0:v:0.\n' +
  'Applying option c:v (codec name) with argument copy.\n' +
  'Applying option map (set input stream mapping) with argument 0:a:0.\n' +
  'Applying option c:a (codec name) with argument copy.\n' +
  'Successfully parsed a group of options.\n' +
  'Opening an output file: /root/recording/files/1585644824875.webm.\n' +
  "[file @ 0x6bebf40] Setting default whitelist 'file,crypto'\n" +
  'Successfully opened the file.\n']
ffmpeg::process::data [data:'[webm @ 0x6ba0700] dimensions not set\n' +
  'Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument\n' +
  'Stream mapping:\n' +
  '  Stream #0:0 -> #0:0 (copy)\n' +
  '  Stream #0:1 -> #0:1 (copy)\n' +
  '    Last message repeated 1 times\n' +
  '[AVIOContext @ 0x6b9ca80] Statistics: 0 seeks, 0 writeouts\n' +
  '[AVIOContext @ 0x6b99300] Statistics: 208 bytes read, 0 seeks\n']

i also see the same error in :#4

i follow the suggestion,but the error is all the same .
OS: ubuntu 18.04
&
FFMPEG: install ffmpeg form source:https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz

when test with ffmpeg:
ffmpeg -codecs | grep vp8

the result is:

ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
 DEV.L. vp8                  On2 VP8 (decoders: vp8 vp8_v4l2m2m libvpx ) (encoders: libvpx vp8_v4l2m2m )

Can you help me?Thanks.

Could not write header for output file

Hello,

I'm getting the error below. I run server and and app correctly but when i click record button, it gets this error and save record file as 0 byte.

image

If you can help me about this problem, I will be very happy :))

Thanks in advance,

Record video only stream

Hi
Trying to record a video stream without audio using ffmpeg with the following sdp:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFmpeg
c=IN IP4 127.0.0.1
t=0 0
m=video ${video.remoteRtpPort} RTP/AVP 101
a=rtpmap:101 VP8/90000
a=sendonly

But it fails:

...
Applying option map (set input stream mapping) with argument 0:a:0.
Stream map 0:a:0 matches no streams.
To ignore this, add a trailing '?' to the map

npm install error

Server: Ubuntu Server 20.04 LTS
Node.js: v16.14.2
Npm: 8.5.0
Python: python3

When I "npm install" in server, I got the below error message.
Could you please let me know what I am missing?

npm ERR! code 1
npm ERR! path /home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup
npm ERR! command failed
npm ERR! command sh -c node npm-scripts.js postinstall
npm ERR! npm-scripts.js [INFO] running task "postinstall"
npm ERR! npm-scripts.js [INFO] executing command: node npm-scripts.js worker:build
npm ERR! npm-scripts.js [INFO] running task "worker:build"
npm ERR! npm-scripts.js [INFO] executing command: make -C worker
npm ERR! make: Entering directory '/home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup/worker'
npm ERR! # Updated pip and setuptools are needed for meson
npm ERR! # --system is not present everywhere and is only needed as workaround for
npm ERR! # Debian-specific issue (copied from
npm ERR! # gluster/gstatus#33), fallback to command without
npm ERR! # --system if the first one fails.
npm ERR! /usr/bin/python3 -m pip install --system --target=/home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup/worker/out/pip pip setuptools ||
npm ERR! /usr/bin/python3 -m pip install --target=/home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup/worker/out/pip pip setuptools ||
npm ERR! echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package"
npm ERR! Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package
npm ERR! # Install meson and ninja using pip into custom location, so we don't
npm ERR! # depend on system-wide installation.
npm ERR! /usr/bin/python3 -m pip install --upgrade --target=/home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup/worker/out/pip meson ninja
npm ERR! make: Leaving directory '/home/ubuntu/mediasoup3-record-demo/server/node_modules/mediasoup/worker'
npm ERR! /usr/bin/python3: No module named pip
npm ERR! /usr/bin/python3: No module named pip
npm ERR! /usr/bin/python3: No module named pip
npm ERR! make: *** [Makefile:75: meson-ninja] Error 1

webm file garbled

image

All of my recordings end up progressively glitching until they look like this. Any ideas to the cause?

Running on Debian 4.9.168-1+deb9u4 (2019-07-19) x86_64
GStreamer version: GStreamer Core Library version 1.10.4

Documentation should explain the IP meaning and changes needed in this configuration

webRtcTransport: {
listenIps: [ { ip: '0.0.0.0', announcedIp: undefined } ], // TODO: Change announcedIp to your external IP or domain name
enableUdp: true,
enableTcp: true,
preferUdp: true,
maxIncomingBitrate: 1500000
},
plainRtpTransport: {
listenIp: { ip: '0.0.0.0', announcedIp: undefined }, // TODO: Change announcedIp to your external IP or domain name
rtcpMux: true,
comedia: false
}

Recording 2 samples at once ?

Is it possibile to record 2 samples of 1 video ?

I tried running the process twice with gstreamer but the second video does work , i'm not very familiar with gstreamer though and i'm getting this error:

info: [GStreamer - err.data]: data: 0:00:01.029949000 35142 0x7f901c02d240 FIXME basesink gstbasesink.c:3248:gboolean gst_base_sink_default_event(GstBaseSink *, GstEvent *): stream-start event without group-id. Consider implementing group-id handling in the upstream elements

Deploying on a remote server

Hi Ethan,

Thank you for the work on this project.

I created a local version that copies from my local webcam and streams via RTMP to twitch. This all works fine with no issues. But then I deployed it to digitalocean, same parameters and using the remote ip configuration, but ffmpeg no longer receives any stream. Could this be an sdp issue? could you help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.