Hello here! I’m work with Gstreamer for 6 months, and in last time I can’t fix trouble with lose timestamp with rtsp. My pipeline here.
def pipeline_get_launch(self, rtsp_path, folder_path, camera_id, archive_hour_path)-> str:
return (f"rtspsrc location={rtsp_path} protocols=tcp tcp-timeout=20000000 timeout=20000000 latency=400 ! "
f"rtpjitterbuffer latency=500 drop-on-latency=true add-reference-timestamp-meta=true do-retransmission=true do-lost=true ! "
f"rtph264depay ! h264parse ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=20000000000 ! tee name=t "
f"t. ! queue ! mpegtsmux ! hlssink target-duration=2 max-files=5 playlist-length=2 "
f"playlist-location={folder_path}/{camera_id}_playlist.m3u8 location={folder_path}/segment_%d.ts "
f"t. ! queue name=queuefilesink ! filesink name=mp4sink location={archive_hour_path}/archive_live.mp4")
I know that it not perfect, but it work for me.
I use rtsprsc for take stream from camera and with queue save result for hls and save raw video file (filesink). After filesink I use ffmpeg from remove timestamp and create new, but its not work forever.
For example, if I record raw files for 5 mins - sometimes I have problems with ffmpeg (absence of MOV), BUT, if I change for 30 sec or 1 min, I don’t get any errors. I think that due to long data transfer, some packets with timestamps are lost and because of this they do not get into the raw file and ffmpeg cannot process this file into mp4.
Here is the question, what to do? Maybe I need to make changes to my pipeline? Add some synchronization?
Once again, I do not fully understand why the number of errors depends on the difference in recording time, although the pipeline itself does not crash.