illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.95k stars 1.52k forks source link

how to stream video in react native , if video located in azure container #346

Open RupamShaw opened 4 years ago

RupamShaw commented 4 years ago

Is it necessary for stream of mp4 video that needs to be converted any of below format:

Accessing the live stream
RTMP
rtmp://localhost/live/STREAM_NAME
http-flv
http://localhost:8000/live/STREAM_NAME.flv
websocket-flv
ws://localhost:8000/live/STREAM_NAME.flv
HLS
http://localhost:8000/live/STREAM_NAME/index.m3u8
DASH
http://localhost:8000/live/STREAM_NAME/index.mpd
  1. in case of accessing RTMP format rtmp://localhost/live/STREAM_NAME I have to do:

    ffmpeg -re -i ~/Downloads/temp/Ma\ Long\ Forehand\ and\ Backhand\ Technique.mp4 -c copy -f flv rtmp://192.168.31.230/live/

    but my source is not in localhost or filesystem its in azure container. How to access it? VOD

  2. where to use or convert (mp4 to flv using ffmpeg) if I access file from azure container

    To resolve conversion issue (2. point above). I think uploaded (flv dash or hls extension)video in azure container should be flv/dash/hls format?

Question is how to stream video from azure container( source is already converted).?Is it possible? if yes please let me know I would like to use node media server instead of Azure media server I think I should use

Rtsp/Rtmp Relay
NodeMediaServer implement RTSP and RTMP relay with ffmpeg.

Static pull
The static pull mode is executed at service startup and reconnect after failure. It could be a live stream or a file. In theory, it is not limited to RTSP or RTMP protocol.

relay: {
  ffmpeg: '/usr/local/bin/ffmpeg',
  tasks: [
    {
      app: 'cctv',
      mode: 'static',
      edge: 'rtsp://admin:admin888@192.168.0.149:554/ISAPI/streaming/channels/101',
      name: '0_149_101',
      rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http']
    }, {
        app: 'iptv',
        mode: 'static',
        edge: 'rtmp://live.hkstv.hk.lxdns.com/live/hks',
        name: 'hks'
      }, {
        app: 'mv',
        mode: 'static',
        edge: '/Volumes/ExtData/Movies/Dancing.Queen-SD.mp4',
        name: 'dq'
      }
  ]
}
Dynamic pull
When the local server receives a play request. If the stream does not exist, pull the stream from the configured edge server to local. When the stream is not played by the client, it automatically disconnects.

relay: {
  ffmpeg: '/usr/local/bin/ffmpeg',
  tasks: [
    {
      app: 'live',
      mode: 'pull',
      edge: 'rtmp://192.168.0.20',
    }
  ]
}

but doen't have any idea how to use this tasks--edge for azure container

if No, then mp4 file(or converted file flv hls or dash) should be in nodemedia server . Please guide how to proceed.