Node-Media-Server
Node-Media-Server copied to clipboard
How can i record rtmp video to mp4 and where can i find the saved video ?
here's my config
const NodeMediaServer = require('./');
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60
},
http: {
port: 8000,
mediaroot: './media',
allow_origin: '*'
},
https: {
port: 8443,
key: './privatekey.pem',
cert: './certificate.pem',
},
auth: {
api: true,
api_user: 'admin',
api_pass: 'admin',
play: false,
publish: false,
secret: 'nodemedia2017privatekey'
},
trans: {
ffmpeg: 'C:/Users/lenovo/Downloads/ffmpeg-20190612-caabe1b-win64-static/bin/ffmpeg.exe',
tasks: [
{
app: 'live',
ac: 'aac',
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]'
}
]
}
};
let nms = new NodeMediaServer(config)
nms.run();
i think you need change
ffmpeg: 'C:/Users/lenovo/Downloads/ffmpeg-20190612-caabe1b-win64-static/bin/ffmpeg.exe'
to
ffmpeg: 'C:\\Users\\lenovo\\Downloads\\ffmpeg-20190612-caabe1b-win64-static\\bin\\ffmpeg.exe'
And video will go to media direction
unfortunately, it doesn't work !
how does the config looks like ?! here's an RTMP test demo 'rtmp://s3b78u0kbtx79q.cloudfront.net/cfx/st/honda_accord' i have put it in config like this but still cannot get video in media direction !
trans: {
ffmpeg: 'C:\\Users\\lenovo\\Downloads\\ffmpeg-20190612-caabe1b-win64-static\\bin\\ffmpeg.exe',
tasks: [
{
app: 'rtmp://s3b78u0kbtx79q.cloudfront.net/cfx/st/honda_accord',
ac: 'aac',
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]'
}
]
}
mediaroot: './media',
This should to be set to something like c:\media in windows /usr/media in linuxe
saved video can be found in media folder in your_root_project/
how to download it from the frontend with authetication e.g IP:8000/media/date-time.mp4?sign=1503458721-80c1d1ad2e0c2ab63eebb50eed64201a
how to download it from the frontend with authetication e.g IP:8000/media/date-time.mp4?sign=1503458721-80c1d1ad2e0c2ab63eebb50eed64201a
You can add an api call to your server to download the video
@Viruss98 Can you please share the example