RTSPtoWeb icon indicating copy to clipboard operation
RTSPtoWeb copied to clipboard

webrtc stream freezes after few seconds

Open xiki808 opened this issue 3 years ago • 4 comments

Stream freezes on the demo page for webrtc just after a few seconds ( 5~10 )

ERRO[2022-02-21T17:34:55Z] stream no video call=ErrorStreamNoVideo channel=0 func=HTTPAPIServerStreamWebRTC module=http_webrtc stream=bedroom

xiki808 avatar Feb 21 '22 17:02 xiki808

I have formatted the raspberry pi and just installed this service to make sure that there are no other conflicts. Unfortunately I got the same results.

I have one camera that 'disconnects' the webrtc stream after ~10s and another ~90s

Is there something I can do to fix this?

xiki808 avatar Feb 22 '22 12:02 xiki808

@xiki808 How did you make the WebRTC Stream work in the first place? Any additional configuration you've done other than specifying the RTSP Stream URL?

gigincg avatar Aug 05 '22 16:08 gigincg

@gigincg thanks for following up. I have two cameras registered one is a POE and wired, the other is streamed through wifi. Both I can view the feed without problems from their app or web platform. But on RTSPtoWeb I have problems with the wifi camera. I think it's because it's an older camera.

Here's my RTSPtoWeb config:

{
  "channel_defaults": {},
  "server": {
    "debug": true,
    "http_debug": false,
    "http_demo": true,
    "http_dir": "web",
    "http_login": "admin",
    "http_password": "HighTech888",
    "http_port": ":10401",
    "https": false,
    "https_auto_tls": false,
    "https_auto_tls_name": "",
    "https_cert": "server.crt",
    "https_key": "server.key",
    "https_port": ":443",
    "ice_credential": "",
    "ice_servers": [
      "stun:stun.l.google.com:19302"
    ],
    "ice_username": "",
    "log_level": "debug",
    "rtsp_port": ":5541",
    "token": {
      "backend": "http://127.0.0.1/test.php",
      "enable": false
    },
    "webrtc_port_max": 0,
    "webrtc_port_min": 0
  },
  "streams": {
    "bedroom": {
      "channels": {
        "0": {
          "url": "rtsp://admin:[email protected]:5541/Streaming/Channels/101"
        }
      },
      "name": "bedroom"
    },
    "garage": {
      "channels": {
        "0": {
          "url": "rtsp://10.0.0.101:554/onvif1"
        }
      },
      "name": "garage"
    }
  }
}

Also here's an ffprobe debug log of each camera, in case it helps to points out something.

The working Bedroom camera:

root@raspberrypi:~# ffprobe -v debug rtsp://admin:[email protected]:5541/Streaming/Channels/101
ffprobe version 4.3.4-0+deb11u1+rpt2 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-mmal --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-sand --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[tcp @ 0x556f1d1e60] No default whitelist set
[tcp @ 0x556f1d1e60] Original list of addresses:
[tcp @ 0x556f1d1e60] Address 10.0.0.13 port 5541
[tcp @ 0x556f1d1e60] Interleaved list of addresses:
[tcp @ 0x556f1d1e60] Address 10.0.0.13 port 5541
[tcp @ 0x556f1d1e60] Starting connection attempt to 10.0.0.13 port 5541
[tcp @ 0x556f1d1e60] Successfully connected to 10.0.0.13 port 5541
[rtsp @ 0x556f21e870] SDP:
v=0
o=- 1659866202559804 1659866202559804 IN IP4 10.0.0.13
s=Media Presentation
e=NONE
b=AS:5050
t=0 0
a=control:rtsp://10.0.0.13:5541/Streaming/Channels/101/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1280,720
a=control:rtsp://10.0.0.13:5541/Streaming/Channels/101/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z01AII2NQCgC3/gLcBAQFAAAD6AAAw1DoYAD0/AABMS0u8uNDAAen4AAJiWl3lwo,aO44gA==
a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;
a=appversion:1.0

[rtsp @ 0x556f21e870] video codec set to: h264
[rtsp @ 0x556f21e870] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[rtsp @ 0x556f21e870] RTP Packetization Mode: 1
[rtsp @ 0x556f21e870] Extradata set to 0x556f221b00 (size: 60)
[rtp @ 0x556f1d1cc0] No default whitelist set
[udp @ 0x556f1d5400] No default whitelist set
[udp @ 0x556f1d5400] end receive buffer size reported is 425984
[udp @ 0x556f232000] No default whitelist set
[udp @ 0x556f232000] end receive buffer size reported is 425984
[rtsp @ 0x556f21e870] setting jitter buffer size to 500
[rtsp @ 0x556f21e870] hello state=0
[h264 @ 0x556f2216c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x556f2216c0] Format yuvj420p chosen by get_format().
[h264 @ 0x556f2216c0] Reinit context to 1280x720, pix_fmt: yuvj420p
[h264 @ 0x556f2216c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x556f2216c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
    Last message repeated 4 times
[rtsp @ 0x556f21e870] All info found
Input #0, rtsp, from 'rtsp://admin:[email protected]:5541/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.240000, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn, 50 tbc
[h264 @ 0x556f243530] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x556f243530] nal_unit_type: 8(PPS), nal_ref_idc: 3

The failing Garage camera:

root@raspberrypi:~# ffprobe -v debug rtsp://10.0.0.101:554/onvif1
ffprobe version 4.3.4-0+deb11u1+rpt2 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-mmal --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-sand --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[tcp @ 0x5589bf7e60] No default whitelist set
[tcp @ 0x5589bf7e60] Original list of addresses:
[tcp @ 0x5589bf7e60] Address 10.0.0.101 port 554
[tcp @ 0x5589bf7e60] Interleaved list of addresses:
[tcp @ 0x5589bf7e60] Address 10.0.0.101 port 554
[tcp @ 0x5589bf7e60] Starting connection attempt to 10.0.0.101 port 554
[tcp @ 0x5589bf7e60] Successfully connected to 10.0.0.101 port 554
[rtsp @ 0x5589c44870] SDP:
v=0
o=- 1421069297525233 1 IN IP4 10.0.0.101
s=H.264 Video, RtspServer_0.0.0.2
t=0 0
a=tool:RtspServer_0.0.0.2
a=type:broadcast
a=control:*
a=range:npt=0-
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42001F;sprop-parameter-sets=Z0IAH5WoFAFuQA==,aM48gA==
a=control:track1
m=audio 0 RTP/AVP 8
a=control:track2
a=rtpmap:8 PCMA/8000

Failed to parse interval end specification ''
[rtsp @ 0x5589c44870] video codec set to: h264
[rtsp @ 0x5589c44870] RTP Packetization Mode: 1
[rtsp @ 0x5589c44870] RTP Profile IDC: 42 Profile IOP: 0 Level: 1f
[rtsp @ 0x5589c44870] Extradata set to 0x5589c47a90 (size: 22)
[rtsp @ 0x5589c44870] audio codec set to: pcm_alaw
[rtsp @ 0x5589c44870] audio samplerate set to: 8000
[rtsp @ 0x5589c44870] audio channels set to: 1
[rtp @ 0x5589bf7cc0] No default whitelist set
[udp @ 0x5589c48eb0] No default whitelist set
[udp @ 0x5589c48eb0] end receive buffer size reported is 425984
[udp @ 0x5589c59170] No default whitelist set
[udp @ 0x5589c59170] end receive buffer size reported is 425984
[rtsp @ 0x5589c44870] setting jitter buffer size to 500
[rtp @ 0x5589bf7750] No default whitelist set
[udp @ 0x5589c698b0] No default whitelist set
[udp @ 0x5589c698b0] end receive buffer size reported is 425984
[udp @ 0x5589c79b70] No default whitelist set
[udp @ 0x5589c79b70] end receive buffer size reported is 425984
[rtsp @ 0x5589c44870] CSeq 4 expected, 0 received.
[rtsp @ 0x5589c44870] method SETUP failed: 500 Internal Server Error
[rtsp @ 0x5589c44870] Allow: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER,USER_CMD_SET

rtsp://10.0.0.101:554/onvif1: Server returned 5XX Server Error reply

Maybe there's a setting I can change in my camera to make it work? Or maybe it is just not compatible? I would like to know if there's a way to determine if a camera is not compatible or not.

xiki808 avatar Aug 07 '22 09:08 xiki808

Hi @xiki808! Did you manage to fix this? I'm currently going through the same issue :(

rmj1405 avatar Mar 14 '24 10:03 rmj1405