I'm looking for some universal way to dump rtsp stream. I want to figure out, that some rtsp stream is working well and server is sending some watchable video.
openRTSP
At first, google recommends me openRTSP tool.
openRTSP -4 ${stream_link} > ${output_file}
But output video file dumped by that tool is not really correct. Video decoder (ffdec) returns many errors like "Failed to decode video packet" and "[h264] no frame!", which don't suit me.
ffmpeg
Then I've tried to dump rtsp stream with ffmpeg tool.
ffmpeg -loglevel debug -i "${stream_link}" -s 640x480 -vcodec copy -acodec copy -y ${output_file}
But streaming process was interrupted often by error:
Application provided invalid, non monotonically increasing dts to muxer in stream 0: 730672 >= 730672
av_interleaved_write_frame(): Invalid argument
I'm trying to use --fflags igndts
but ffmpeg doesn't ignore these errors. It doesn't make any sense, because that error actually means that audio and video streams are sending asynchronously. The worst thing is that dumped file, resulted by that interrupted dump, is not correct too. Ffdec return some error:
ERROR [mov,mp4,m4a,3gp,3g2,mj2] moov atom not found
ERROR [ffdec] av_open_input_file: Operation not permitted
After a nice cup of googling I've found, that it's really old ffmpeg's muxer bug.
mplayer
Than I've tried to use mplayer with LIVE_555 lib.
mplayer -noframedrop -dumpfile ${output_file} -dumpstream ${stream_link}
But I've got some errors too.
Stream not seekable!
Core dumped ;)
Question
I think I'm doing something wrong. It's sounds really ridiculous, that there is no way to save rtsp stream in correct and playable video-file.
Maybe there are some another tools which can help with that task? Actually, I will be grateful for any advice for all kind of libs and languages. But that process should be automatic and have cli.
Refinements
Something about 50% experiments I've done on the localhost with vlc-streamer that emulates rtsp-broadcaster. Here is a manual which I try to follow.
I have really fresh and latest ffmpeg with x264 support, that I've installed by that useful thread.
Did you try vlc to save rtsp stream? It worked for me.I tried with graphical interface though. But it should also work from command line.