Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to have 2 streams with rotation #1623

Closed
h3rbst opened this issue Feb 28, 2025 · 5 comments
Closed

Not possible to have 2 streams with rotation #1623

h3rbst opened this issue Feb 28, 2025 · 5 comments
Labels
question Further information is requested

Comments

@h3rbst
Copy link

h3rbst commented Feb 28, 2025

Since Version 1.9.2 it is not possible for me anymore to have two stable http streams with rotation.
I am using go2rtc with frigate.
All cameras are Reolink 810a and the "terrasse_detect" and "gasse_detect" are not working anymore when both are enabled. When disabling one of them, everything is working fine.

This is my configuration:

log:
  exec: trace
  format: text
webrtc:
  candidates:
  - 10.0.0.20:8555
  - stun:8555
  listen: :8555
ffmpeg:
  http: -avoid_negative_ts make_zero -flags low_delay -fflags nobuffer+genpts+discardcorrupt
    -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000
    -i {input}
  bin: /usr/lib/ffmpeg/7.0/bin/ffmpeg
streams:
  einfahrt:
    - rtsp://frigate:[email protected]:554/h265Preview_01_main
  einfahrt_detect:
    - rtsp://frigate:[email protected]:554/h264Preview_01_sub
  terrasse:
    - rtsp://frigate:[email protected]:554/h265Preview_01_main
  terrasse_detect:
    - ffmpeg:http://10.0.40.30/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=PASSWORD#video=h264#rotate=90#media=video#backchannel=0
  gasse:
    - rtsp://frigate:[email protected]:554/h265Preview_01_main
  gasse_detect:
    - ffmpeg:http://10.0.40.20/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=PASSWORD#video=h264#rotate=-90#media=video#backchannel=0
  garage:
    - rtsp://frigate:[email protected]:554/h265Preview_01_main
  garage_detect:
    - rtsp://frigate:[email protected]:554/h264Preview_01_sub
  garten:
    - rtsp://frigate:[email protected]:554/h265Preview_01_main
  garten_detect:
    - rtsp://frigate:[email protected]:554/h264Preview_01_sub


api:
  origin: '*'
hass:
  config: /config
rtsp:
  default_query: mp4

@AlexxIT AlexxIT added the question Further information is requested label Feb 28, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Feb 28, 2025

I don't know what you mean. Go2rtc absolutely doesn't matter how many ffmpeg streams you have. Zero or ten.
Based on the current description, it's hard to help.

You can try installing go2rtc separately from Frigate. Preferably the latest version. And check if the problem repeats.

@h3rbst
Copy link
Author

h3rbst commented Feb 28, 2025

Okay so as you said, I installed go2rtc seperately and did only setup the cameras gasse, gasse_detect, terrasse, terrasse_detect.
Then I setup frigate to fetch the camera streams not from the internal go2rtc, but the "remote" one.
Here is the log from go2rtc:

14:27:02,340	info	go2rtc version=1.9.8 platform=linux/amd64 revision=199fdd6
14:27:02,340	info	config path=/go2rtc.yaml
14:27:02,340	info	[rtsp] listen addr=:8554
14:27:02,341	info	[webrtc] listen addr=:8555/tcp
14:27:02,341	info	[api] listen addr=:1984
14:27:34,422	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.20/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=2,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/1736db952290cd3db935fec5f5aa1170
14:27:34,422	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.30/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=1,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/159d646924f89af6ccea1650b684dc17
14:27:39,435	debug	[exec] run rtsp launch=5.012516944s
14:27:39,435	trace	[exec] kill with signal=9
14:27:40,206	debug	[exec] run rtsp launch=5.784031131s
14:27:40,206	trace	[exec] kill with signal=9
14:27:54,344	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.30/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=1,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/159d646924f89af6ccea1650b684dc17
14:27:54,369	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.20/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=2,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/1736db952290cd3db935fec5f5aa1170
14:27:59,491	debug	[exec] run rtsp launch=5.121136004s
14:27:59,491	trace	[exec] kill with signal=9
14:28:00,263	debug	[exec] run rtsp launch=5.918108492s
14:28:00,263	trace	[exec] kill with signal=9
14:28:00,560	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.30/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=1,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/159d646924f89af6ccea1650b684dc17
14:28:01,388	debug	[exec] run rtsp args=ffmpeg,-hide_banner,-v,error,-fflags,nobuffer,-flags,low_delay,-i,http://10.0.40.20/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=,-c:v,libx264,-g,50,-profile:v,high,-level:v,4.1,-preset:v,superfast,-tune:v,zerolatency,-pix_fmt:v,yuv420p,-an,-vf,transpose=2,-user_agent,ffmpeg/go2rtc,-rtsp_transport,tcp,-f,rtsp,rtsp://127.0.0.1:8554/1736db952290cd3db935fec5f5aa1170
14:28:06,252	debug	[exec] run rtsp launch=5.691234532s
14:28:07,478	debug	[exec] run rtsp launch=6.09018059s

So I did start go2rtc at 14:27:00 as you can see.
I started frigate at 14:27:30 - then the errors begin as you can see as well.
At this time I of course get error messages from frigate, that the camera is not available.
"Funny" thing is, that at 14:28:00 I opened the streams of gasse_detect and terrasse_detect (via go2rtc ui, clicking on "stream") and voila - no more errors in go2rtc and frigate.

Hope this helps a little bit?

@h3rbst
Copy link
Author

h3rbst commented Feb 28, 2025

Current configuration to keep it more simple:

log:
  exec: trace
webrtc:
  candidates:
      - 10.0.0.20:8555
      - stun:8555

streams:
  terrasse:
  - rtsp://frigate:[email protected]:554/h265Preview_01_main
  terrasse_detect:
  - ffmpeg:http://10.0.40.30/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=PASSWORD#video=h264#rotate=90#media=video#backchannel=0
  gasse:
  - rtsp://frigate:[email protected]:554/h265Preview_01_main
  gasse_detect:
  - ffmpeg:http://10.0.40.20/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=PASSWORD#video=h264#rotate=270#media=video#backchannel=0

@AlexxIT
Copy link
Owner

AlexxIT commented Feb 28, 2025

The problem may be in the start time. I see that the stream starts for more than 5 seconds. Usually applications wait just 5s for a response. Therefore, Frigate may drop the connection without waiting more.

You can:

  • throw your camera in the trash (Reolink has a terrible firmwares)
  • try to tune ffmpeg source with custom args (don't know how to help you with this)
  • try to change timeout in the Frigate

@h3rbst
Copy link
Author

h3rbst commented Mar 1, 2025

Awesome! Thanks for your help! The timeout in frigate was the solution to fix this problem. Now it is working rocksolid again.

If others have this problem as well, use the following in your frigate configuration for the rotated camera:

input_args: -timeout 10000000

@h3rbst h3rbst closed this as completed Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants