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.89k stars 1.51k forks source link

Unable to play the .m3u8 stream in vlc #598

Open irtaza9 opened 11 months ago

irtaza9 commented 11 months ago

I want to play the .m3u8 stream in vlc but it is not working, I am getting 404 in the browser when I put the link in react-player.

What I am doing.

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

const config = {
  logType: 3,
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60,
  },
  http: {
    port: 8000,
    mediaroot: "./media",
    allow_origin: "*",
  },
  trans: {
    ffmpeg: "./ffmpeg.exe",
    tasks: [
      {
        app: "live",
        vc: "copy",
        vcParam: [],
        ac: "aac",
        acParam: ["-ab", "64k", "-ac", "1", "-ar", "44100"],
        rtmp: true,
        rtmpApp: "live2",
        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]",
      },
    ],
  },
};

const nms = new NodeMediaServer(config);
nms.run();
ffmpeg -rtsp_transport tcp -i rtsp://myuser:myuserpassword@camera_ip -c copy -f flv rtmp://localhost/live/stream

Output from NMS:

8/3/2023 19:42:54 34444 [INFO] Node Media Server v2.6.2
8/3/2023 19:42:54 34444 [INFO] Node Media Rtmp Server started on port: 1935
8/3/2023 19:42:54 34444 [INFO] Node Media Http Server started on port: 8000
8/3/2023 19:42:54 34444 [INFO] Node Media WebSocket Server started on port: 8000       
8/3/2023 19:42:54 34444 [INFO] Node Media Trans Server started for apps: [ live ] , MediaRoot: ./media, ffmpeg version: 2023-07-19-git-efa6cec759-full_build-www.gyan.dev
8/3/2023 16:48:15 21940 [INFO] [rtmp connect] id=M81TQEAS ip=::1 app=live args={"app":"live","type":"nonprivate","flashVer":"FMLE/3.0 (compatible; Lavf60.10.100)","tcUrl":"rtmp://localhost:1935/live"}

What is current playing

What is my goal?

I want to play .m3u8 stream same as .flv is playing on all platforms

amsyary commented 9 months ago

any update?, i try to play video using ffmeg but it doesn't play using hls

HMT2002 commented 8 months ago

Same with the DASH and .flv, only the RTMP stream works. My solution is use different package for HLS and DASH, haven't work with .flv yet.

inertia666 commented 8 months ago

Only RTMP and FLV streams work for me. HLS or Dash doesn't work.