0

I created RTMP server with node-media-server, I wanted to upload video after the stream ends. The scenario is :

USER A -> rtmp://localhost:1935/userA
USER B -> rtmp://localhost:1935/userB

After both stream ends, it will save on ./media folders, after media is saved, I wanted to upload it to s3 bucket. But it seems that the library doesn't have anything to tell me where was the media saved. Is there any way I could do it?

import NodeMediaServer from 'node-media-server'
import PathFFMPEG from 'ffmpeg-static'

const NMS = new NodeMediaServer({
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60
  },
  http: {
    port: 8000,
    allow_origin: '*',
    mediaroot: './media'
  },
  trans: {
    ffmpeg: PathFFMPEG,
    tasks: [{
      app: 'live',
      mp4: true,
      mp4Flags: '[movflags=frag_keyframe+empty_moov]',
    }]
  }
})

NMS.run()

NMS.on('doneConnect', (id, args) => {
  console.log('[NodeEvent on doneConnect]', `id=${id} args=${JSON.stringify(args)}`);
});
mandaputtra
  • 922
  • 3
  • 18
  • 36

0 Answers0