6

I have developed a video chatting application,but the video is displayed with high latency.video is streamed over rtsp.how to reduce the delay in playing the rtsp stream?

Raji A C
  • 1,910
  • 4
  • 22
  • 30
  • i guess we should provide options to the media player,Any one please help.. – Raji A C May 29 '12 at 09:27
  • It may be to do with the buffering, not sure how to change those directly but have you tried just over raw HTTP rather than RTSP? Also, how bad is the latency? Are we talking fractions of a second, seconds, minutes? – Michael Berry May 29 '12 at 23:56
  • Try udp multicast streaming if your rtsp server supports it. Otherwise, you can force multicast rtp over rtsp in udp mode from vlc client side (vlc command option `:rtsp-mcast`). Other option is to use rtp over rtsp in tcp mode (vlc command option `:rtsp-tcp`). – ee. May 30 '12 at 00:57
  • 1
    I also +1 the suggestion by @berry120 to use buffering features of vlc; for example: `:file-caching`, `:rtsp-caching` etc. – ee. May 30 '12 at 01:05
  • i have tried http streaming,but it failed to stream and just played the output of my webcam.so i changed to rtsp.the delay is more than 5 seconds ,but voice reach the other end with in 2 seconds. – Raji A C May 30 '12 at 04:09

2 Answers2

3

What video codec are you using? You should be able to reduce latency to <1s using following options:

  1. Add :live-caching=0 to input handling options (e.g. when opening webcam)
  2. Play around with codecs, for example change codec to mpeg-4 (seems to work better for my configuration where I have Android device as stream receiver)
  3. Add :sout-mux-caching=10 (or some other low value) to stream options

With following line used to stream webcam video (notice: no audio) to my Android I was able to slightly reduce latency:

:sout=#transcode{vcodec=mp4v,vb=800,fps=30,scale=0.25,acodec=none}:rtp{sdp=rtsp://:8554/} :sout-keep :sout-mux-caching=10

vArDo
  • 4,387
  • 1
  • 15
  • 26
2

Currently you have to configure like this

String[] options = {
                ":file-caching=0",
                ":network-caching=300",
                ":sout = #transcode{vcodec=x264,vb=800,scale=0.25,acodec=none,fps=23}:display :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep"};
mediaPlayer.playMedia(address, options);

The most important is network-caching=300. Defualt is 1000 ms.

Eliasz Kubala
  • 3,414
  • 1
  • 18
  • 27