How to reduce RTSP streaming delay.

This forum is about all development around libVLC.
K_AA
New Cone
New Cone
Posts: 1
Joined: 22 May 2014 10:29

How to reduce RTSP streaming delay.

Postby K_AA » 22 May 2014 10:43

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);

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to reduce RTSP streaming delay.

Postby Jean-Baptiste Kempf » 05 Jun 2014 14:55

Decrease the caching.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

paulraj85
New Cone
New Cone
Posts: 1
Joined: 03 Feb 2016 08:17

Re: How to reduce RTSP streaming delay.

Postby paulraj85 » 03 Feb 2016 09:44

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

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to reduce RTSP streaming delay.

Postby Jean-Baptiste Kempf » 28 Jun 2016 09:43

--network-caching is the option you need
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Rahul29
New Cone
New Cone
Posts: 2
Joined: 01 Jun 2017 08:35

Re: How to reduce RTSP streaming delay.

Postby Rahul29 » 01 Jun 2017 10:10

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

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to reduce RTSP streaming delay.

Postby Jean-Baptiste Kempf » 11 Jun 2017 16:20

Do you have the same delay in VLC?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Psykomusic
New Cone
New Cone
Posts: 2
Joined: 12 Jun 2017 11:24

Re: How to reduce RTSP streaming delay.

Postby Psykomusic » 12 Jun 2017 11:39

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 ?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to reduce RTSP streaming delay.

Postby Jean-Baptiste Kempf » 16 Jun 2017 16:16

Et VLC s'en sort mieux?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Psykomusic
New Cone
New Cone
Posts: 2
Joined: 12 Jun 2017 11:24

Re: How to reduce RTSP streaming delay.

Postby Psykomusic » 19 Jun 2017 11:37

Hi, thx for your answer
Yes vlc is much better than my app using libvlc

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to reduce RTSP streaming delay.

Postby Jean-Baptiste Kempf » 27 Jul 2017 10:00

Same version of VLC and libVLC?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

cdf1982
New Cone
New Cone
Posts: 3
Joined: 10 May 2018 08:47

Re: How to reduce RTSP streaming delay.

Postby cdf1982 » 17 Oct 2024 10:16

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15242
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to reduce RTSP streaming delay.

Postby Rémi Denis-Courmont » 17 Oct 2024 12:00

The default value is 1 seconds, but that probably doesn't mean what you think it does.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests