How to dump raw RTSP stream to file?

Felix picture Felix · Apr 28, 2013 · Viewed 127.3k times · Source

Is it possible to dump a raw RTSP stream to file and then later decode the file to something playable?

Currently I'm using FFmpeg to receive and decode the stream, saving it to an mp4 file. This works perfectly, but is CPU intensive, and will severely limit the number of RTSP streams I can receive simultaneously on my server.

I would like to save the stream to file without decoding it, and delay the decoding part to when the file needs to be opened.

Is this possible?

I have tried VLC, which is even more CPU intensive than FFmpeg. I've also looked at this question where the answer says dumping RTSP to file is not useful, and this question, where the comment below the question says "Raw RTSP content is not well suited for save and replay...", which seems to indicate that there is way.

Thanks in advance!


EDIT Here is the command I'm using for FFmpeg:

ffmpeg -i rtsp://@192.168.241.1:62159 -r 15 C:/DB_Videos/2013-04-30 17_18_34.703.mp4

Answer

av501 picture av501 · Apr 30, 2013

If you are reencoding in your ffmpeg command line, that may be the reason why it is CPU intensive. You need to simply copy the streams to the single container. Since I do not have your command line I cannot suggest a specific improvement here. Your acodec and vcodec should be set to copy is all I can say.

EDIT: On seeing your command line and given you have already tried it, this is for the benefit of others who come across the same question. The command:

ffmpeg -i rtsp://@192.168.241.1:62156 -acodec copy -vcodec copy c:/abc.mp4

will not do transcoding and dump the file for you in an mp4. Of course this is assuming the streamed contents are compatible with an mp4 (which in all probability they are).