iizukanao / node-rtsp-rtmp-server

RTSP/RTMP/HTTP hybrid server
MIT License
1.1k stars 282 forks source link

Reduce delay while stream the webcam #134

Open neumartin opened 5 years ago

neumartin commented 5 years ago

Hi!, I'm streaming the webcam with this command:

ffmpeg -re -i /dev/video0 -c:v libx264 -preset fast -c:a libfdk_aac -ab 128k -ar 44100 -f rtsp rtsp://localhost:7373/live/STREAM_NAME

In console I get:

  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264), yuv422p, 640x480, q=-1--1, 20 fps, 90k tbn, 20 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 2047 fps= 20 q=-1.0 Lsize=N/A time=00:01:42.20 bitrate=N/A dup=364 drop=0 speed=0.997x

But when test with VLC or other video player I can see 3 or 4 second of delay. Can I improve some parameter to get no more than 0.5 seconds of video delay? I want to build a videoconference software. Thanks!

iizukanao commented 5 years ago

Try reducing network buffer on client side. However, I'm not sure if <0.5 seconds of delay is possible. Also, I think WebRTC is more suitable technology for video conferencing.