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

How can i record rtmp video to mp4 and where can i find the saved video ?

Open hathemi opened this issue 6 years ago • 8 comments
trafficstars

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();

hathemi avatar Jul 26 '19 14:07 hathemi

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

cpanel10x avatar Jul 27 '19 01:07 cpanel10x

unfortunately, it doesn't work !

hathemi avatar Jul 29 '19 08:07 hathemi

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]'
}
]
}

hathemi avatar Jul 29 '19 08:07 hathemi

mediaroot: './media',

This should to be set to something like c:\media in windows /usr/media in linuxe

xtendtech avatar Jan 14 '20 19:01 xtendtech

saved video can be found in media folder in your_root_project/

HealerNguyen avatar Aug 12 '20 04:08 HealerNguyen

how to download it from the frontend with authetication e.g IP:8000/media/date-time.mp4?sign=1503458721-80c1d1ad2e0c2ab63eebb50eed64201a

gigabyteservice avatar Jun 26 '21 11:06 gigabyteservice

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

HealerNguyen avatar Jun 26 '21 11:06 HealerNguyen

@Viruss98 Can you please share the example

gigabyteservice avatar Jun 28 '21 11:06 gigabyteservice