I currently receive and store a RTSP stream from a camera with openRTSP with a command like this:
openRTSP -4 "rtsp://192.168.41.185/rtsp_tunnel?h26x=4&line=1&inst=2" > movie.mp4
I can do the same using FFmpeg:
ffmpeg -i "rtsp://192.168.41.185/rtsp_tunnel?h26x=4&line=1&inst=2" -vcodec copy movie.mp4
The video frames from the camera are 1280x720 (H.264) at around 30 fps and have a milliseconds timestamp stamped in. When I view the movie.mp4 created by ffmpeg it looks pretty nice, the seconds stamped into the video stream seem rather accurate. On the contrary, if I view the movie.mp4 created by openRTSP, the seconds in the video timestamp last definitively longer than the ones in reality. So one second on video could last two seconds in reality. I made several tests, and it is not an issue of network performance or of handling the messages received from the camera. The reason seems to be the part where the messages are encoded into this MP4 container.
Is FFmpeg so much faster doing this than openRTSP?
Can I optimize the MP4 encoding in openRTSP somehow?