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

hls Cannot GET

Open smicroz opened this issue 6 years ago • 4 comments

Hi,

For some reason i'm getting a message "Cannot GET /live/main/index.m3u8"

Debian 9 64bit checked that public/live/main is created.

Any suggestion?

smicroz avatar Jan 27 '19 09:01 smicroz

Hi @smicroz !!

I had the same problem and following @SAMYEL06 steps I fixed it #134.

I tell you how I fixed it: 1º. Install ffmpeg > 4.

2º. Configure mediaroot at app.js. Create a directory with proper permissions. In my case I replaced './media' by '/media/steamvideo'

http: {
    port: 8000,
    mediaroot: '/media/steamvideo',
    webroot: './www',
    allow_origin: '*'
  },

3º. Add to your app.js (inside the config const )

trans: {  
  ffmpeg: '/path/to/ffmpeg',   // In my case (Ubuntu)/usr/bin/ffmpeg, in my Mac OS /usr/local/bin/ffmpeg
  tasks: [  
    {  
      app: 'live',  
      ac: 'aac',  
      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]'  
    }  
  ]
},  

Stop and start your node app and good luck!

I hope it helps you!

BR. Kike Beltrán 👋

kikebeltran avatar Oct 17 '19 18:10 kikebeltran

I love you

mosaghafian avatar Dec 28 '22 05:12 mosaghafian

I love you

I don't know why it didn't work for me.

Here's my app.js:

const NodeMediaServer = require('node-media-server');

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60,
    trans: {
    ffmpeg: '/usr/bin/ffmpeg',
    tasks: [
    {
      app: 'live',
      ac: 'aac',
      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]'
    }
  ]
}
  },
  http: {
    port: 8000,
    mediaroot: './media',
    webroot: './www',
    allow_origin: '*'
  }
};

var nms = new NodeMediaServer(config)
nms.run();

I am using Linux Mint, which is based on Ubuntu. I correctly installed ffmpeg.


EDIT: Fixed, I wrote "trans" in the wrong place.

This is how it should be:

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60
  },
  http: {
    port: 8000,
    mediaroot: './media',
    allow_origin: '*'
  },
  trans: {
    ffmpeg: '/usr/local/bin/ffmpeg',
    tasks: [
      {
        app: 'live',
        hls: true,
        hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
        hlsKeep: true, // to prevent hls file delete after end the stream
        dash: true,
        dashFlags: '[f=dash:window_size=3:extra_window_size=5]',
        dashKeep: true // to prevent dash file delete after end the stream
      }
    ]
  }
};

Cohvir avatar Dec 29 '22 13:12 Cohvir

Good Evening, I don't know if anyone can help me, the HLS link that would be 'http//localhost:8000/live/USER_NAME' doesn't work anymore, the RTMP link works normally and fluently, but in the project I'm working on I need the HLS link I have looked for an answer to this but I can't find it I hope you can help me thank you very much, this is my code

const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 30, ping_timeout: 60 }, http: { port: 8000, allow_origin: '*' }, trans: { ffmpeg: '../ffmpeg/bin/fmpeg', tasks: [ { app: 'live', hls: true, hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]', hlsKeep: true, // to prevent hls file delete after end the stream dash: true, dashFlags: '[f=dash:window_size=3:extra_window_size=5]', dashKeep: true // to prevent dash file delete after end the stream } ] } };

DanielCampaz avatar Jan 25 '23 00:01 DanielCampaz