Page 1 of 1
How to reduce RTSP streaming delay.
Posted: 22 May 2014 10:43
by K_AA
Hello!
I develop an Qt application that can capture video from webcam and stream it using RTSP. On the other side my app receive video stream.
But I noticed a stable delay about 3-4 seconds. Does anybody know how to reduce this lag?
Code for video capturing and streaming.
Code: Select all
m_vlcInstance = libvlc_new(0, NULL);
libvlc_vlm_add_broadcast(m_vlcInstance, "mybroadcast", "dshow://", "#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://:5544/}", 0, NULL, TRUE, 0);
libvlc_vlm_play_media(m_vlcInstance, "mybroadcast");
Code for video stream receiving.
Code: Select all
inst = libvlc_new (0, NULL);
m = libvlc_media_new_path (inst, "rtsp://127.0.0.1:5544/");
mp = libvlc_media_player_new_from_media (m);
libvlc_media_release (m);
libvlc_media_player_set_hwnd (mp, ui->widget->winId());
libvlc_media_player_play (mp);
Re: How to reduce RTSP streaming delay.
Posted: 05 Jun 2014 14:55
by Jean-Baptiste Kempf
Decrease the caching.
Re: How to reduce RTSP streaming delay.
Posted: 03 Feb 2016 09:44
by paulraj85
Hi,
Iam trying to stream a video from IP camera using RTSP and displaying the video in a mfc application using libvlc. There is a delay upto 2sec in my application, Is there any way to reduce the delay?
In vlc player Tools->Preferences->Input/codecs, I choose Live555 stream transport to RTP over RTSP and changed Default Catching policy to Lowest Latency. By choosing this setting I can see the video delay is reduced in VLC player compare to my application.
Kindly help me how to make these settings through the code
Thank You
Re: How to reduce RTSP streaming delay.
Posted: 28 Jun 2016 09:43
by Jean-Baptiste Kempf
--network-caching is the option you need
Re: How to reduce RTSP streaming delay.
Posted: 01 Jun 2017 10:10
by Rahul29
Hi,
I am also facing the same problem. I am streaming a video from IP camera using RTSP and displaying the video in a Qt application using libvlc. There is a delay upto 2sec in my application, Is there any way to reduce the delay?
I have tried passing :network-cashing=200 to my URL but it doesn't work.
rtsp://admin:admin@192.168.253.99:554/cam/realmonitor?channel=1&subtype=0&unicast=true :network-caching=200
looking forward to some help.
Thanks
Re: How to reduce RTSP streaming delay.
Posted: 11 Jun 2017 16:20
by Jean-Baptiste Kempf
Do you have the same delay in VLC?
Re: How to reduce RTSP streaming delay.
Posted: 12 Jun 2017 11:39
by Psykomusic
Hi !
I'm trying the same thing, using LibVlc for a QtApplication in way to be cross-platform ios and android. I'm able to play the RTSP stream from an ipCamera but there a big delay (few seconds) and this delay is less important in the VLC app. I tried to reduce the network-caching but with this solution I drop too much frames and freezes appear.
With the logs I can see that lot of picture are late and not display.
In fact I have 2 messages :
avcodec decoder: More than 4 late frames, dropping frame
core video output: picture is too late to be displayed (missing 3237 ms).
Maybe have you some solution for this problem to.
I'm not fluent english and I know your french, there is the french message.
En fait j'utilise LibVlc pour une appli en Qt/Qml que j'utiliserai sur platforme mobile et desktop. Je suis déjà capable de récupérer les stream en bonne qualité mais avec un delay. Lorsque je diminue le Network-caching j'ai alors beaucoup de frames qui sont lachées et cela ajoute de la saccade à ma vidéo (en plus d'avoir toujours un peu de delay). A moins d'avoir un cache de 1000ms je drop beacoup de frame et j'ai des freeze. Avez-vous une solution pour ce type de problème ?
Re: How to reduce RTSP streaming delay.
Posted: 16 Jun 2017 16:16
by Jean-Baptiste Kempf
Et VLC s'en sort mieux?
Re: How to reduce RTSP streaming delay.
Posted: 19 Jun 2017 11:37
by Psykomusic
Hi, thx for your answer
Yes vlc is much better than my app using libvlc
Re: How to reduce RTSP streaming delay.
Posted: 27 Jul 2017 10:00
by Jean-Baptiste Kempf
Same version of VLC and libVLC?
Re: How to reduce RTSP streaming delay.
Posted: 17 Oct 2024 10:16
by cdf1982
Hi! I'm also doing some tests with the "--network-caching" option, and I wonder what's the default value for RTSP streams when the option is not specified.
Re: How to reduce RTSP streaming delay.
Posted: 17 Oct 2024 12:00
by Rémi Denis-Courmont
The default value is 1 seconds, but that probably doesn't mean what you think it does.