Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created January 17, 2024 02:16
Show Gist options
  • Save changtimwu/bea5c9e8988915dfd071cbb1f07bb1a7 to your computer and use it in GitHub Desktop.
Save changtimwu/bea5c9e8988915dfd071cbb1f07bb1a7 to your computer and use it in GitHub Desktop.
frigate source code

go2rtc

work with go2rtc by API

  • in the Dockerfile, go2rtc is integrated in the form of executable instead of package/library

frontend

  • It's based on preact. No typescript.
  • No widget libs like MUI is used. They implemented their own.
iei@iei-POCm-ADL:~/frigate/web/src$ ls
api         app.css  assets      context  hooks  index.css  __mocks__    routes       __tests__  vite-env.d.ts
AppBar.jsx  app.tsx  components  env.js   icons  main.tsx   preact.d.ts  Sidebar.jsx  utils
  • the region editor is based canvas
iei@iei-POCm-ADL:~/frigate/web/src$ grep -i canvas  `find . -name "*.*sx"
`
./components/CameraImage.jsx:  const canvasRef = useRef(null);
./components/CameraImage.jsx:      if (canvasRef.current) {
./components/CameraImage.jsx:        const ctx = canvasRef.current.getContext('2d');
./components/CameraImage.jsx:    [img, scaledHeight, scaledWidth, setHasLoaded, onload, canvasRef]
./components/CameraImage.jsx:    if (!config || scaledHeight === 0 || !canvasRef.current) {
./components/CameraImage.jsx:  }, [apiHost, canvasRef, name, img, searchParams, scaledHeight, config]);
./components/CameraImage.jsx:        <canvas data-testid="cameraimage-canvas" height={scaledHeight} ref={canvasRef} width={scaledWidth} />
./components/JSMpegPlayer.jsx:      if (video.els.canvas.webkitRequestFullScreen) {
./components/JSMpegPlayer.jsx:        video.els.canvas.webkitRequestFullScreen();
./components/JSMpegPlayer.jsx:        video.els.canvas.mozRequestFullScreen();
./components/JSMpegPlayer.jsx:    video.els.canvas.addEventListener('click',fullscreen);
@changtimwu
Copy link
Author

changtimwu commented Jan 17, 2024

image
  • TOPO1
[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"15/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":720,"width":1280},{"avg_frame_rate":"0/0","bit_rate":"64000","codec_long_name":"PCMA-law/G.711A-law"}]}}]
  • TPLINK
[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"15/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":480,"width":640},{"avg_frame_rate":"0/0","bit_rate":"64000","codec_long_name":"PCMA-law/G.711A-law"}]}}]

@changtimwu
Copy link
Author

go2rtc has its own dashboard(web ui)
http:// /live/webrtc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment