node-rtsp-recorder
node-rtsp-recorder copied to clipboard
Recorded video and audio files are not playing
Hi,
I've been having quite a painful time recording my ip camera rtsp stream, the recorded audio/video files arent playing. Please i need some help.
I'm using a windows 10 x64 machine.
Thanks so much.
I noticed that some of the last files before the timeout (in the code example) could play, the rest couldnt
While running one of the files that didnt play through ffmpeg, i get the following error: "moov atom not found". Could the issue be from the way the file was closed?
Was this resolved??
No it wasnt. I tried experimenting with ffmpeg and i got the mp4 recorded files, but it was with the command line and quite unwieldy. I'm trying to work out a cleaner way to achieve that maybe with the an npm ffmpeg module or spawning an ffmpeg process anytime i need to record my ip camera rtsp stream. I used the following command line arguments with ffmpeg; ffmpeg -i rtsp://192.168.0.103/live/ch00_1 -f mp4 -t 20 -c:v libx264 -preset veryfast -c:a aac summary4.mp4 -hide_banner - rtsp://192.168.0.103/live/ch00_1 is my ip camera live rtsp stream and summary4.mp4 is the name of the output mp4 video file, -t 20 specifies that the video should be 20 seconds long. You can get more info from the follow links [https://www.bugcodemaster.com/article/convert-videos-mp4-format-using-ffmpeg], [https://www.bugcodemaster.com/article/how-extract-and-join-video-files-using-ffmpeg]. Cheers!
At a point i realised the issue with the node-rtsp-recorder was that it wasnt ending the mp4 files properly. The mp4 files need some metadata information in order to play but the module was apparently closing the files without including those information hence the files it generated couldnt be played.
I figured this out. I will make a pull request. The correct tags are needed.
I figured this out. I will make a pull request. The correct tags are needed.
Was this solved? Getting the same result. Thanks
https://github.com/Cain310/securityCam-demo
On Mon, Jul 29, 2019, 7:36 PM Skullcan [email protected] wrote:
I figured this out. I will make a pull request. The correct tags are needed.
Was this solved? Getting the same result. Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sahilchaddha/node-rtsp-recorder/issues/9?email_source=notifications&email_token=ALIXJ2VOIVR5KFID4JGJWHTQB55IZA5CNFSM4HNU5XHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3CJ2AQ#issuecomment-516201730, or mute the thread https://github.com/notifications/unsubscribe-auth/ALIXJ2XAEZTLYIBAIU2VTG3QB55IZANCNFSM4HNU5XHA .
https://github.com/Cain310/securityCam-demo … On Mon, Jul 29, 2019, 7:36 PM Skullcan @.***> wrote: I figured this out. I will make a pull request. The correct tags are needed. Was this solved? Getting the same result. Thanks — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#9?email_source=notifications&email_token=ALIXJ2VOIVR5KFID4JGJWHTQB55IZA5CNFSM4HNU5XHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3CJ2AQ#issuecomment-516201730>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALIXJ2XAEZTLYIBAIU2VTG3QB55IZANCNFSM4HNU5XHA .
Ok, thank you very much!
I tryed to fix, but I have the problem again, my file is corrupted
my solution: in record.js replace kill stream method to killStream() { this.writeStream.stdin.write('q') } and
get child process to
getChildProcess(fileName) { var args = ['ffmpeg', '-rtsp_transport','tcp','-i', this.url] const mediaArgs = this.getArguments() mediaArgs.forEach((item) => { args.push(item) }); args.push(fileName) console.log("args", args.join(' ')) return childProcess.exec(args.join(' '), function(err, stdout, stderr) {}) }
one quick fix is to change output format on recorder.js
replace -- return '.mp4'
with ++ return '.mov'
the problem could be rooted to a codec issue with .mp4
@leodesigndev ur solution didnt work for me :(
Maybe someone will need it, my gist. Tested only under windows 10
- make sure the ffmpeg command is available from the console
- ... other requirements
the .mp4 file was corrupted, I tried changing it to .mkv and it worked. You can try to change in file /node_modules/node-rtsp-recorder/src/helpers/recorder.js and edit in getExxtension() function, change .mp4 file name to .mkv
getExtension(){
if (this.categoryType === 'audio') {
return '.avi'
}
if (this.categoryType === 'image') {
return '.jpg'
}
return '.mkv'
}
my solution: in record.js replace kill stream method to killStream() { this.writeStream.stdin.write('q') } and
get child process to
getChildProcess(fileName) { var args = ['ffmpeg', '-rtsp_transport','tcp','-i', this.url] const mediaArgs = this.getArguments() mediaArgs.forEach((item) => { args.push(item) }); args.push(fileName) console.log("args", args.join(' ')) return childProcess.exec(args.join(' '), function(err, stdout, stderr) {}) }
Thanks your so much!
this module just copy raw rtsp encoding, it is not mp4, I think the point is just to record the stream. To play the file must be encode first to let say mpeg
ffmpeg -i recorded.mp4 -f mpegts -c:v mpeg1video playable.mp4
it works for me