I prepared a IP camera with Gstremer on RTSP and it seems to online and real time, with command:
gst-launch-1.0 rtspsrc location=rtsp://192.168.1.138:554/axis-media/media.amp ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false
it is excellent and delay for displaying about 40 ms(milliseconds).
If i delete sync=false
end of autovideosink
it is displaying with 2 seconds delay.
Now I want Sync RTSP streaming on a file. At first I create a pipe by mkfifo file.ts
in /tmp
and then use of :
gst-launch-1.0 rtspsrc location=rtsp://192.168.1.138:554/axis-media/media.amp ! rtph264depay ! mpegtsmux ! filesink location=file.ts
it works and sync RTSP with ts
format and h264
codec correctly. I can play it with mplayer file.ts
or gst-play-1.0 file.ts
successfully but has 2 seconds delay!
I tried use of sync=false
or autovideosink
but i get error or doesn't effect.
How can I decrease delay in file sinking?
Thanks
After a lot of searching I found issue Default valve of Jitter Buffer in Official Gstreamer documentation is 200ms but in reality is 2 seconds.
“latency” guint The maximum latency of the jitterbuffer. Packets will be kept in the buffer for at most this time. Flags : Read / Write Default value : 200 Here
so I can increase delay to 400ms with command:
gst-launch-1.0 rtspsrc latency = 0 location=rtsp://192.168.1.138:554/axis-media/media.amp ! rtph264depay ! mpegtsmux ! filesink location=file.ts
also 400ms delay is for mkfifo, so Named Pipe is not good solution for real time application.