Node-Media-Server
Node-Media-Server copied to clipboard
Cannot play index.m3u8
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
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' }, };
I have the exact same problem
I have the exact same problem
Same, the m3u8 file is not generating for me at all for some reason.
I've found the solution .. if someone still need it, just tell me ^^
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.
The solution :
- 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.
- Check the ffmpeg path as well
==> Look at my example
- 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 !
You Are Awesome Ty! It Worked. Also I got ffmpeg.exe from https://ffmpeg.zeranoe.com/builds/
The solution :
- 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.
- Check the ffmpeg path as well
==> Look at my example
- 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.
how do i change the name of index.m3u8?