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

Cannot play index.m3u8 #134

Open nirvanaonne opened 5 years ago

nirvanaonne commented 5 years ago

I have tested node media server following by https://www.npmjs.com/package/node-media-server#hls but I cannot play hld media as the link below, http://localhost:8000/live/STREAM_NAME/index.m3u8 please help

nirvanaonne commented 5 years ago

Here is my configure, const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 60, ping_timeout: 30 }, http: { port: 8000, webroot: './public', mediaroot: './media', allow_origin: '*' }, https: { port: 8443, key: './privatekey.pem', cert: './certificate.pem', }, auth: { api: true, api_user: 'admin', api_pass: 'admin', play: false, publish: false, secret: 'nodemedia2017privatekey' }, };

lewma commented 5 years ago

I have the exact same problem

redraskal commented 5 years ago

I have the exact same problem

Same, the m3u8 file is not generating for me at all for some reason.

TheAntinormal commented 5 years ago

I've found the solution .. if someone still need it, just tell me ^^

redraskal commented 5 years ago

I've found the solution .. if someone still need it, just tell me ^^

Please do explain! I ditched node media server, but it would be useful to know the solution in case I mess with it again.

TheAntinormal commented 5 years ago

The solution :

1) mediaroot: './media' isn't a valid path, so the m3u8 and dash weren't written and you couldn't access it.

==> Change to mediaroot: 'C:/{path}/{to where you want it to be}' and it will write and easily be reachable.

2) Check the ffmpeg path as well

==> Look at my example

3) Add "vc" to the ffmpeg part because it was set to copy, and it can create an issue (audio works but not the video)

==> I added vc: 'libx264' in the ffmpeg part.

Example (if it helps) :

  http: {
    port: 8080,
    allow_origin: '*',
    mediaroot: 'C:/Users/Sam',
  },
   trans: {
    ffmpeg: '/ffmpeg/bin/ffmpeg.exe',
    tasks: [
      {
        app: 'live',
        ac: 'aac',
    vc: 'libx264',
        hls: true,
        hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
        dash: true,
        dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
      }
    ]
  }
};

This will create a folder "live" into C:/Users/Sam, that will contain a folder called by the name of the STREAM-KEY you wanted, and in this folder will be the m3u8 and mpd files.

So basically, the m3u8 and dash will be at C:/Users/Sam/Live/Stream-key/, and will be reachable from http://localhost:8080/live/stream-key/index.m3u8 (or mpd).

It was pretty simple because I used to make conf files for nginx, and it works the same way, it needs valid paths to write ^^

Hope this helps !

felipe0528 commented 5 years ago

You Are Awesome Ty! It Worked. Also I got ffmpeg.exe from https://ffmpeg.zeranoe.com/builds/

apple3000 commented 5 years ago

The solution :

  1. mediaroot: './media' isn't a valid path, so the m3u8 and dash weren't written and you couldn't access it.

==> Change to mediaroot: 'C:/{path}/{to where you want it to be}' and it will write and easily be reachable.

  1. Check the ffmpeg path as well

==> Look at my example

  1. Add "vc" to the ffmpeg part because it was set to copy, and it can create an issue (audio works but not the video)

==> I added vc: 'libx264' in the ffmpeg part.

Example (if it helps) :

  http: {
    port: 8080,
    allow_origin: '*',
    mediaroot: 'C:/Users/Sam',
  },
   trans: {
    ffmpeg: '/ffmpeg/bin/ffmpeg.exe',
    tasks: [
      {
        app: 'live',
        ac: 'aac',
  vc: 'libx264',
        hls: true,
        hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
        dash: true,
        dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
      }
    ]
  }
};

This will create a folder "live" into C:/Users/Sam, that will contain a folder called by the name of the STREAM-KEY you wanted, and in this folder will be the m3u8 and mpd files.

So basically, the m3u8 and dash will be at C:/Users/Sam/Live/Stream-key/, and will be reachable from http://localhost:8080/live/stream-key/index.m3u8 (or mpd).

It was pretty simple because I used to make conf files for nginx, and it works the same way, it needs valid paths to write ^^

Hope this helps !

Hi guy! i knew nms is linux server? is that windows server? where can i download it? i had same problem as using docker version on synology nas. m3u8 did not play. i don't know edit the file in docker image.

rutvikjani commented 9 months ago

how do i change the name of index.m3u8?