Skip to content

Stream Recording and Livestreaming

mrlt8 edited this page Mar 13, 2023 · 1 revision

Recording

The bridge can be configured to record all or select camera streams to the container which can be mapped to a local directory.

Enable recording

environment:
...
  - TZ=America/New_York
  - RECORD_ALL=True
volumes:
  - /local/path/:/record/

Or to specify select cameras, where CAM_NAME is the camera name in UPPERCASE and _ in place of spaces and hyphens:

  - RECORD_CAM_NAME=True
  - RECORD_OTHER_CAM=True

Recording configuration

  • Recording location:

    You can specify the directory where the videos will be saved by mapping your /local/path/on/host/ to the /record/ directory in the container:

    volumes:
          - /local/path/on/host/:/record/

    You can also configure the path where the clips will be saved using RECORD_PATH. The camera name is available as an optional variable {cam_name} for lowercase and {CAM_NAME} for uppercase

      - RECORD_PATH=/record/{cam_name}
  • File name config:

    By default, the bridge will name the files with the current date time using the format: CAM_NAME_YYYY-MM-DD_HH-MM-SS_TZ.mp4. The camera name is available as an optional variable {cam_name} for lowercase and {CAM_NAME} for uppercase, and the time portion of the name can be customized using the strftime format:

      - RECORD_FILE_NAME={cam_name}_%Y%m%d_%H_%M_%S

    The timezone used for the name can be configured using TZ database name:

      - TZ=America/New_York
  • File segment length:

    The bridge will split the recordings into 60 second clips from the top of the hour by default, however, this can be changed using:

      - RECORD_LENGTH=300
    

Livestreaming

Basic livestream support is available for YouTube and Facebook, but you can also specify any custom rtmp server for other services like Twitch.

To use this feature, set a new env in your docker-compose.yml with the service (YOUTUBE_ or FACEBOOK_) prefix followed by the camera name in UPPERCASE with _ in place of spaces and hyphens, and set your stream key as the value. Custom rtmp servers can be specified using the LIVESTREAM_ prefix:

  - YOUTUBE_FRONT_DOOR=MY-STREAM-KEY
  - FACEBOOK_OTHER_CAM=MY-STREAM-KEY
  # twitch example:
  - LIVESTREAM_CAM_NAME=rtmp://jfk.contribute.live-video.net/app/MY-STREAM-KEY

🏠 Home Assistant - Use CAM_OPTIONS and add a new entry for each camera:

- CAM_NAME: Cam Name
  LIVESTREAM: rtmp://jfk.contribute.live-video.net/app/MY-STREAM-KEY
- CAM_NAME: other cam
  LIVESTREAM: rtmp://a.rtmp.youtube.com/live2/my-youtube-key