I am working on a project and trying to save the RTSP stream in the file. But the following error stops the process
video:331639kB audio:5199kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Non-monotonous DTS in output stream 0:1; previous: 5439375, current: 5439283; changing to 5439376. This may result in incorrect timestamps in the output file.Can anyone from the community please help me get rid of this error?
Hey! Can you please share the command you are using?
And please read this once: Overview of RTSP and RTMP
Hope this may help you!
Sure, I am using the following command.
ffmpeg βrtsp://192.168.0.100:554/cam/realmonitor?channel=1&subtype=0β -c copy -f segment -segment_time 00:01:00 -reset_timestamps 1 -segment_format mkv -strftime 1 /home/user/.camera/recordings/2022/8/19/%H_%M_%S.mkv
Saving an RTSP (Real Time Streaming Protocol) stream to a file using FFmpeg can be achieved using the FFmpeg command-line tool. Here is an example command that will save an RTSP stream to a file:
ffmpeg -i rtsp://<stream-url> -c copy output.mp4
This command will save the RTSP stream to a file called output.mp4
using the -c
copy flag, which tells FFmpeg to copy the stream directly without re-encoding it.
If you are having difficulty saving the RTSP stream to a file stably, there are a few things you can try:
Increase the timeout value using the timeout flag. This will allow ffmpeg more time to establish a connection to the stream before giving up.
For example:
ffmpeg -i rtsp://<stream-url> -c copy -timeout 60 output.mp4
- Try using a lower bitrate stream if available. This can help to reduce the load on the network and may improve stability.
- Make sure that you have a stable network connection. If the connection is unstable, this can cause problems when saving the stream to a file.
- Try using a different version of ffmpeg. Itβs possible that a newer or older version of the tool may be more stable when saving RTSP streams to a file.
I hope this helps! Let me know if you have any other questions.