viamrtsp

package module
v0.0.0-...-9b3f282 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 29 Imported by: 0

README

Build

The binary is statically linked with FFmpeg v6.1, eliminating the need for separate FFmpeg installation on target machines.

  • Build for Linux targets:
    • Install canon: go install github.com/viamrobotics/canon@latest
    • Startup canon dev container.
      • Linux/Arm64: canon -profile viam-rtsp-antique -arch arm64
      • Linux/Amd64: canon -profile viam-rtsp-antique -arch amd64
    • Build binary: make
  • Build for MacOS target:
    • Build binary: make
  • Binary will be in bin/<OS>-<CPU>/viamrtsp
  • Clean up build artifacts: make clean
  • Clean up all files not tracked in git: make clean-all

Sample Config

 {
  "name": "rtsp-1",
  "namespace": "rdk",
  "type": "camera",
  "model": "erh:viamrtsp:rtsp",
  "attributes": {
    "rtp_passthrough": true,
    "rtsp_address": "rtsp://foo:bar@192.168.10.10:554/stream"
  }
}

Models:

  • erh:viamrtsp:rtsp - Codec agnostic. Will auto detect the codec of the rtsp_address.
  • erh:viamrtsp:rtsp-h264 - Only supports H264 codec.
  • erh:viamrtsp:rtsp-h265 - Only supports H265 codec.
  • erh:viamrtsp:rtsp-mjpeg - Only supports M-JPEG codec.

Notes

  • rtp_passthrough (which improves video streaming efficiency) is supported with the H264 codec if the rtp_passthrough attrbute is set to true
  • Non fatal LibAV errors are suppressed unles the module is run in debug mode.
  • Heavily cribbed from gortsplib examples:

Documentation

Overview

Package viamrtsp implements RTSP camera support in a Viam module

Index

Constants

View Source
const (
	// Unknown indicates an error when no available video codecs could be identified
	Unknown videoCodec = iota
	// Agnostic indicates that a discrete video codec has yet to be identified
	Agnostic
	// H264 indicates the h264 video codec
	H264
	// H265 indicates the h265 video codec
	H265
	// MJPEG indicates the mjpeg video codec
	MJPEG
)

Variables

View Source
var (

	// ModelAgnostic selects the best available codec.
	ModelAgnostic = family.WithModel("rtsp")
	// ModelH264 uses the h264 codec.
	ModelH264 = family.WithModel("rtsp-h264")
	// ModelH265 uses the h265 codec.
	ModelH265 = family.WithModel("rtsp-h265")
	// ModelMJPEG uses the mjpeg codec.
	ModelMJPEG = family.WithModel("rtsp-mjpeg")
	// Models is a slice containing the above available models.
	Models = []resource.Model{ModelAgnostic, ModelH264, ModelH265, ModelMJPEG}
	// ErrH264PassthroughNotEnabled is an error indicating H264 passthrough is not enabled.
	ErrH264PassthroughNotEnabled = errors.New("H264 passthrough is not enabled")
)

Functions

func H2645StartCode

func H2645StartCode() []byte

H2645StartCode is start code byte sequence for H264/H265 NALs.

func SetLibAVLogLevelFatal

func SetLibAVLogLevelFatal()

SetLibAVLogLevelFatal sets libav errors to fatal log level to cut down on log spam

Types

type Config

type Config struct {
	Address          string                             `json:"rtsp_address"`
	RTPPassthrough   bool                               `json:"rtp_passthrough"`
	IntrinsicParams  *transform.PinholeCameraIntrinsics `json:"intrinsic_parameters,omitempty"`
	DistortionParams *transform.BrownConrady            `json:"distortion_parameters,omitempty"`
}

Config are the config attributes for an RTSP camera model.

func (*Config) Validate

func (conf *Config) Validate(path string) ([]string, error)

Validate checks to see if the attributes of the model are valid.

Directories

Path Synopsis
cmd
module
This package provides the entrypoint for the module
This package provides the entrypoint for the module
remote
This package provides the entrypoint for the remote
This package provides the entrypoint for the remote
Package formatprocessor processes RTP packets into Units when can then be re-encoded heavily copied from https://github.com/bluenviron/mediamtx/blob/main/internal/formatprocessor/h264.go https://github.com/bluenviron/mediamtx/blob/main/internal/unit/h264.go & related package & the rest of that package
Package formatprocessor processes RTP packets into Units when can then be re-encoded heavily copied from https://github.com/bluenviron/mediamtx/blob/main/internal/formatprocessor/h264.go https://github.com/bluenviron/mediamtx/blob/main/internal/unit/h264.go & related package & the rest of that package
This package is a test client for RTSP cam integration tests
This package is a test client for RTSP cam integration tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL