Skip to content

Nearly Working #19

@noideaman

Description

@noideaman

I can manually adopt and preview a usb webcam through a raspberry pi with this software. just missing recording and snapshot preview
and it takes 10-15 seconds for the video to load (that last part may be more mediamtx, but at the same time unifi should be recording and the streams i watch in protect should be proxied instead of starting up a new one?)

services:
#webcam to rtsp
  mediamtx: 
    devices:
      - /dev/video0:/dev/video0
    volumes:
      - /docker/onvif/mediamtx.yml:/mediamtx.yml
      - /docker/onvif/snapshot:/snapshot
    restart: always
    network_mode: "host"
    image: bluenviron/mediamtx:latest-ffmpeg-rpi

  #funny onvif proxy tool
  onvif:
    network_mode: "host"
    image: onvif-server:latest
    restart: always
    volumes:
      - /docker/onvif/config.yaml:/onvif.yaml

  #lighttpd for holding snapshot image
  lighttpd:
    volumes:
      - /docker/onvif/snapshot:/var/www/html/onvif/snapshot:ro
    ports:
      - 81:80
    image: rtsp/lighttpd:latest
    restart: always

I am not using the macvlan proxy because even with that enabled unifi would not automatically detect it, and using the macaddress of the primary nic works as well
onvif config yaml

onvif:
  - mac: funnymacaddress
  ports:
    server: 8081
    rtsp: 8554
    snapshot: 8580
  name: Channel1
  uuid: 15b21259-77d9-441f-9913-3ccd8a82e430
  highQuality:
    rtsp: /cam
    snapshot: /onvif/snapshot
    width: 1280
    height: 720
    framerate: 10
    bitrate: 2048
    quality: 4
  target:
    hostname: localhost
    ports:
      rtsp: 554
      snapshot: 81

mediamtx config (only key part is the end that i pasted here the rest are defaults)

cam:
  runOnInit: ffmpeg -f v4l2 -video_size 1280x720 -i /dev/video0 -c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
  runOnInitRestart: yes

so TLDR;
1: any ideas on what may be missing for recording?
2: how does snapshot work? i have a jpg sitting and visible via ip:8580/onvif/snapshot/snapshot.jpg (it loads by default if you visit onvif/snapshot)
3: ideas on making the stream load faster?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions