question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Camera Support]: UDP Only RTSP Stream is not requesting connection to UDP

See original GitHub issue

Describe the problem you are having

In order to stream my Nest cameras into Frigate, I have create an application which essentially creates a local relay for the Nest camera RTSP feeds. You can see the current state of the repo here: Jak Guru’s Nest RTSP Proxy.

Due to a limitation in the code base, the application only supports UDP connections (both from FFMPEG and from clients). Don’t ask me why - I built it in 2 days. That limitation aside, all other tests show that it is performing quite well. (via FFprobe and VLC).

However, frigate is not able to start the ffmpeg process in order to stream the feed. I have ensured that the feed uses:

input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport udp -stimeout 3500000 -use_wallclock_as_timestamps 1

(specifically note the -rtsp_transport udp)

In the logs I see the following error:

ERROR   : [tcp @ 0x55c8ec4a0680] Connection to tcp://127.0.0.1:554?timeout=3500000 failed: Connection refused
ERROR   : rtsp://127.0.0.1:554/front-door: Connection refused

This leads me to believe that despite sending a camera-specific configuration override, the -rtsp_transport udp flag is being ignored. I have confirmed that other flags ARE working such as -stimeout 3500000 (by default it’s -stimeout 5000000).

Version

0.10.1-83481AF

Frigate config file

mqtt:
  host: ********************
birdseye:
  enabled: true
  width: 640
  height: 480
  mode: objects
rtmp:
  enabled: false
detect:
  width: 640
  height: 480
objects:
  track:
    - person
    - car
    - dog
    - cat
record:
  enabled: true
  retain:
    days: 5
    mode: active_objects
snapshots:
  enabled: true
  bounding_box: true
cameras:
  door:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport udp -stimeout 3500000 -use_wallclock_as_timestamps 1
      inputs:
        - path: rtsp://127.0.0.1:554/front-door
          roles:
            - detect
            - rtmp
            - record
    detect:
      width: 640
      height: 480
      fps: 7
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 1000
  frontyard:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      inputs:
        - path: rtsp://*************@*******************:554/h264Preview_07_sub
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 640
      height: 480
      fps: 7
    snapshots:
      crop: true
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 1000
  street:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      inputs:
        - path: rtsp://*************@*******************:554/h264Preview_10_sub
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 640
      height: 480
      fps: 7
    snapshots:
      crop: true
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 1000
  upstairs:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      inputs:
        - path: rtsp://*************@*******************:554/h264Preview_05_sub
          roles:
            - rtmp
            - detect
            - record
    detect:
      width: 640
      height: 480
      fps: 7
    snapshots:
      crop: true
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 1000

Relevant log output

[2022-06-01 17:23:57] ffmpeg.door.detect             ERROR   : [tcp @ 0x5652c341a680] Connection to tcp://127.0.0.1:554?timeout=3500000 failed: Connection refused
[2022-06-01 17:23:57] ffmpeg.door.detect             ERROR   : rtsp://127.0.0.1:554/front-door: Connection refused
[2022-06-01 17:23:57] frigate.video                  ERROR   : door: Unable to read frames from ffmpeg process.
[2022-06-01 17:23:57] frigate.video                  ERROR   : door: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100



Input #0, rtsp, from 'rtsp://127.0.0.1:554/front-door':
  Metadata:
    title           : SDM
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 512x384 [SAR 1:1 DAR 4:3], 15 fps, 30 tbr, 90k tbn, 30 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Nest Hello Doorbell

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jakgurucommented, Jun 1, 2022

Wait… I’m guessing that it might be an issue that I’m trying to reach 127.0.0.1 instead of whatever docker puts as the host… I’ll check that out and will report back

0reactions
jakgurucommented, Jun 2, 2022

So at the end of the day the IP/Hostname was the issue. In order to resolve it, I had to:

1. Add the following line in the docker-compose.yaml file per this StackOverflow answer

extra_hosts:
- "host.docker.internal:host-gateway"

2. Change the feed input from: rtsp://127.0.0.1:554/front-door to rtsp://host.docker.internal/front-door

I am closing this issue and I thank you for the support and assistance. Next time I’ll have a cup of coffee before I post 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding RTSP/ HTTP / UDP Streams - Network Optix
The Port field is only necessary if you are using a non-standard port on your IP cameras. Once all information is input press...
Read more >
TCP vs UDP, Why use UDP for IP Camera's Connection?
RTSP, which uses UDP, is used by many IP cameras, BUT it has colossal routing problems because it needs two separate channels, one...
Read more >
Fix RTSP between IP cameras and Wowza Video
Wowza Video can pull an RTSP stream from an IP camera by using one of two transport modes: UDP or interleave. By default,...
Read more >
Introduction to transmission protocols (rtsp protocol, udp ...
The RTSP protocol uses a push server method to let the audio and video browsers make a request. The network camera just continuously...
Read more >
Camera loses connection and reconnecting every minute
No more disconnects on all 5 cameras for 7 minutes and counting. Works as you have predicted. I changed to RTSP UDP and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found