Node-Media-Server icon indicating copy to clipboard operation
Node-Media-Server copied to clipboard

Cannot play index.m3u8

Open nirvanaonne opened this issue 6 years ago • 9 comments

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 avatar Sep 28 '18 07:09 nirvanaonne

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' }, };

nirvanaonne avatar Sep 28 '18 07:09 nirvanaonne

I have the exact same problem

lewma avatar Oct 14 '18 01:10 lewma

I have the exact same problem

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

redraskal avatar Oct 27 '18 00:10 redraskal

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

TheAntinormal avatar Dec 11 '18 21:12 TheAntinormal

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.

redraskal avatar Dec 12 '18 02:12 redraskal

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 !

TheAntinormal avatar Dec 12 '18 11:12 TheAntinormal

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

felipe0528 avatar Feb 09 '19 18:02 felipe0528

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.

apple3000 avatar Jun 20 '19 02:06 apple3000

how do i change the name of index.m3u8?

rutvikjani avatar Dec 13 '23 05:12 rutvikjani