Node-Media-Server
Node-Media-Server copied to clipboard
Prevent deletion’s of .m3u8 after the stream ends
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.
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); // } // }); // } // });
Hello @gigabyteservice found a solution ? apart that from @pream912 ? facing the same issue.
@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
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.
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