How to save rtsp video stream on TX1?

Hello everyone!I’ve now used gstreamer to receive a live camera video stream successfully.I want to save the rtsp video stream as a video file.Could someone know how to fix this problem?Looking forward to anyone’s kind reply.

Hi, have you tried appending the following elements to your gstreamer pipeline?

matroskamux ! filesink location='my_video.mkv' sync=false

It saves the video to file. You can see other example usages here. You can also skip the matroskamux and dump with filesink to a raw h264/h265 file. You can find additional usage of filesink in the Multimedia API Reference.

Hello dusty_nv!Sorry for my late response firstly.There is a problem that when I used “matroskamux ! filesink location=‘my_video.mkv’ sync=false” to save rtsp video stream to a video file,the file’s total frame num is too big (2306824)which was achieved by


functions with


param.It’s strange that the camera’s framerate is 25fps and the saved video file is only 1min. I suppose the actual total frame num of the saved video file is 1500.So is there any error?

Hi Sulli,
Have you tried to dumped it into h265? Please also share your pipeline of rtsp video streaming for reference.

Hi DaneLLL.My gstreamer pipeline is

gst-launch-1.0 rtspsrc location=rtsp://admin:admin12345@ latency=0 ! tee name=t ! queue ! rtph264depay ! h264parse ! mpegtsmux ! filesink location=\"test.avi\" t. ! queue ! decodebin ! videoconvert ! xvimagesink

I can open test.avi by vlc successfully.
And now my question is why when I use opencv’s functions to get the information of the saved video file named “test.avi”,it’s framerate is 180000 and it’s framenum is also a very big number. Which is impossible because the live rtsp video stream’s framerate is 25.Could you please fix the problem?

Hi Sulli, I think you should post in opencv or gstreamer forums. It looks to be an issue in timestamps which are not configured by NVIDIA plugins.

I’ll have a try.Thank you DaneLLL~