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

Prevent deletion’s of .m3u8 after the stream ends

Open gigabyteservice opened this issue 2 years ago • 5 comments

Prevent deletion’s of .m3u8 after the stream ends We want to make playback after the streaming is over the these .m3u8 files are important so how can I prevent from deleting.

gigabyteservice avatar Mar 11 '22 09:03 gigabyteservice

in node_trans_session.js file, comment out the following lines

// fs.readdir(ouPath, function (err, files) { // if (!err) { // files.forEach((filename) => { // if (filename.endsWith('.ts') // || filename.endsWith('.m3u8') // || filename.endsWith('.mpd') // || filename.endsWith('.m4s') // || filename.endsWith('.tmp')) { // // fs.unlinkSync(ouPath + '/' + filename); // } // }); // } // });

pream912 avatar Apr 09 '22 17:04 pream912

Hello @gigabyteservice found a solution ? apart that from @pream912 ? facing the same issue.

lewatt23 avatar May 12 '22 17:05 lewatt23

@pream912 it's same as deleting fs.unlinkSync(ouPath + '/' + filename); files stays but it can only last 2 sec of video no whole video. this is really important for many people do you have any idea how to save hls files after finishing the stream? @illuspas

gigabyteservice avatar Jul 29 '22 20:07 gigabyteservice

set hlsFlags to change playlist type. trans: { ffmpeg: '/usr/bin/ffmpeg', tasks: [ { app: 'live', hls: true, hlsFlags: '[hls_time=5:hls_list_size=3:hls_playlist_type=event]', } ] }

P.S: remove hls_flags=delete_segments if its there already.

pream912 avatar Jul 30 '22 13:07 pream912

trans: {
    ffmpeg: '/usr/bin/ffmpeg',
    tasks: [
      {
        app: 'live', // or other
        hls: true,
        hlsFlags: '[hls_time=1:hls_list_size=2:hls_playlist_type=event]',
        dash: true,
        dashFlags: '[f=dash:window_size=3:extra_window_size=5]',
		mp4: true,
        mp4Flags: '[movflags=frag_keyframe+empty_moov]',
        'websocket-flv': true,
      },
    ],
  },

even after following your config, still it's not working. this new config changes not even saving the files while commenting this line // fs.unlinkSync(ouPath + '/' + filename); at least saving the file but video is not playing. @pream912

gigabyteservice avatar Jul 30 '22 16:07 gigabyteservice