How to dump raw RTSP stream to file?

前端 未结 3 748
孤独总比滥情好
孤独总比滥情好 2020-12-04 07:59

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,

相关标签:
3条回答
  • 2020-12-04 08:19

    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).

    0 讨论(0)
  • 2020-12-04 08:27

    With this command I had poor image quality

    ffmpeg -i rtsp://192.168.XXX.XXX:554/live.sdp -vcodec copy -acodec copy -f mp4 -y MyVideoFFmpeg.mp4
    

    With this, almost without delay, I got good image quality.

    ffmpeg -i rtsp://192.168.XXX.XXX:554/live.sdp -b 900k -vcodec copy -r 60 -y MyVdeoFFmpeg.avi
    
    0 讨论(0)
  • 2020-12-04 08:37

    You can use mplayer.

    mencoder -nocache -rtsp-stream-over-tcp rtsp://192.168.XXX.XXX/test.sdp -oac copy -ovc copy -o test.avi
    

    The "copy" codec is just a dumb copy of the stream. Mencoder adds a header and stuff you probably want.

    In the mplayer source file "stream/stream_rtsp.c" is a prebuffer_size setting of 640k and no option to change the size other then recompile. The result is that writing the stream is always delayed, which can be annoying for things like cameras, but besides this, you get an output file, and can play it back most places without a problem.

    0 讨论(0)
提交回复
热议问题