I've setup a local RTMP media server with the node-media-server library. It receives media-stream from Streamlabs . I can access it with the localhost link easily and it works without any issue.
const NodeMediaServer = require("node-media-server");
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60,
},
http: {
port: 8000,
allow_origin: "*",
},
};
var nms = new NodeMediaServer(config);
nms.run();
In this way I can only view the live stream. But what if I wanted to go back 10 seconds in the video? As the video is not stored, it is not possible. Is there any way I can achieve it?
To save files for playback you first need to install ffmpeg package using npm. You can use this one https://www.npmjs.com/package/@ffmpeg/ffmpeg
Then add this in your config:
trans: {
ffmpeg: ffmpeg_d.path,
tasks: [
{
app: 'live',
mp4: true,
mp4Flags: '[movflags=frag_keyframe+empty_moov]',
}
]
}
http: {
port: 8020,
webroot: './public',
mediaroot: './media',
allow_origin: '*'
},
A media folder will be added in your root project where you will find streamed video file for playback use.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.