Node-Media-Server
Node-Media-Server copied to clipboard
Files deleted after the streaming finishes
I noticed that all the files are deleted after the streaming has been stopped. The code is part of the core and it doesn't seem to be avoided.
Can anyone give me some suggestions on how to avoid this? (Ok I can fork and change this behaviours, but I'ld prefer to avoid this)
You can remove the option to delete the segments from the task
{
app: 'live',
ac: 'aac',
hls: true,
hlsFlags: '[hls_time=10:hls_list_size=0_**:hls_flags=delete_segments**_]',
dash: false,
dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
}
it doesn't work, here is the code that it is executed when the process exits:
this.ffmpeg_exec.on('close', (code) => {
Logger.log('[Transmuxing end] ' + this.conf.streamPath);
this.emit('end');
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);
}
})
}
});
});
yes, all files deleted. I can see during streaming files (index.m3u8 and index0.ts , index1.ts...) creates and after transmusing all files deleted. https://github.com/illuspas/Node-Media-Server/blob/efc5ef8ffd169e6a914a266a2d07da825ced9734/node_trans_session.js#L89
I noticed that all the files are deleted after the streaming has been stopped. The code is part of the core and it doesn't seem to be avoided.
Can anyone give me some suggestions on how to avoid this? (Ok I can fork and change this behaviours, but I'ld prefer to avoid this)
@tradingstratagem mp4: true, mp4Flags: '[movflags=faststart]' add two lines of code to your config in tasks: eg: trans: { ffmpeg: '/usr/bin/ffmpeg', tasks: [ { ...yours, mp4: true, mp4Flags: '[movflags=faststart]' } ] }
I noticed that all the files are deleted after the streaming has been stopped. The code is part of the core and it doesn't seem to be avoided.
Can anyone give me some suggestions on how to avoid this? (Ok I can fork and change this behaviours, but I'ld prefer to avoid this)
I know that its been a long time since the last reply but I want to know: did you find any solutions for this? I'm stuck with the same problem because the player I'm using in the front end will wait for "EXT-X-ENDLIST" in the index.m3u8 but it's not included at any time.
No, at the end I gave up and I wrote my own implementation
I can save file as .mp4 video after stream finish, my stream is still using .m3u8 while stream run. This is my config for my company's project (using nuxt and vue-video-player for frontend), it run without error
fs.unlinkSync(ouPath + '/' + filename); I have commented this code, hls files remain as it is bit i can't able to play those files after streaming ends.
We want hls to be played even after streaming is finished