streams

package
v1.9.12-cui.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 18 Imported by: 0

README

Examples

streams:
  # known RTSP sources
  rtsp-dahua1:   rtsp://admin:password@192.168.10.90/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
  rtsp-dahua2:   rtsp://admin:password@192.168.10.90/cam/realmonitor?channel=1&subtype=1
  rtsp-tplink1:  rtsp://admin:password@192.168.10.91/stream1
  rtsp-tplink2:  rtsp://admin:password@192.168.10.91/stream2
  rtsp-reolink1: rtsp://admin:password@192.168.10.92/h264Preview_01_main
  rtsp-reolink2: rtsp://admin:password@192.168.10.92/h264Preview_01_sub
  rtsp-sonoff1:  rtsp://admin:password@192.168.10.93/av_stream/ch0
  rtsp-sonoff2:  rtsp://admin:password@192.168.10.93/av_stream/ch1

  # known RTMP sources
  rtmp-reolink1: rtmp://192.168.10.92/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=password
  rtmp-reolink2: rtmp://192.168.10.92/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password
  rtmp-reolink3: rtmp://192.168.10.92/bcs/channel0_ext.bcs?channel=0&stream=1&user=admin&password=password

  # known HTTP sources
  http-reolink1: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password
  http-reolink2: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=admin&password=password
  http-reolink3: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=password

  # known ONVIF sources
  onvif-dahua1:   onvif://admin:password@192.168.10.90?subtype=MediaProfile00000
  onvif-dahua2:   onvif://admin:password@192.168.10.90?subtype=MediaProfile00001
  onvif-dahua3:   onvif://admin:password@192.168.10.90?subtype=MediaProfile00000&snapshot
  onvif-tplink1:  onvif://admin:password@192.168.10.91:2020?subtype=profile_1
  onvif-tplink2:  onvif://admin:password@192.168.10.91:2020?subtype=profile_2
  onvif-reolink1: onvif://admin:password@192.168.10.92:8000?subtype=000
  onvif-reolink2: onvif://admin:password@192.168.10.92:8000?subtype=001
  onvif-reolink3: onvif://admin:password@192.168.10.92:8000?subtype=000&snapshot
  onvif-openipc1: onvif://admin:password@192.168.10.95:80?subtype=PROFILE_000
  onvif-openipc2: onvif://admin:password@192.168.10.95:80?subtype=PROFILE_001

  # some EXEC examples
  exec-h264-pipe:   exec:ffmpeg -re -i bbb.mp4 -c copy -f h264 -
  exec-flv-pipe:    exec:ffmpeg -re -i bbb.mp4 -c copy -f flv -
  exec-mpegts-pipe: exec:ffmpeg -re -i bbb.mp4 -c copy -f mpegts -
  exec-adts-pipe:   exec:ffmpeg -re -i bbb.mp4 -c copy -f adts -
  exec-mjpeg-pipe:  exec:ffmpeg -re -i bbb.mp4 -c mjpeg -f mjpeg -
  exec-hevc-pipe:   exec:ffmpeg -re -i bbb.mp4 -c libx265 -preset superfast -tune zerolatency -f hevc -
  exec-wav-pipe:    exec:ffmpeg -re -i bbb.mp4 -c pcm_alaw -ar 8000 -ac 1 -f wav -
  exec-y4m-pipe:    exec:ffmpeg -re -i bbb.mp4 -c rawvideo -f yuv4mpegpipe -
  exec-pcma-pipe:   exec:ffmpeg -re -i numb.mp3 -c:a pcm_alaw -ar:a 8000 -ac:a 1 -f wav -
  exec-pcmu-pipe:   exec:ffmpeg -re -i numb.mp3 -c:a pcm_mulaw -ar:a 8000 -ac:a 1 -f wav -
  exec-s16le-pipe:  exec:ffmpeg -re -i numb.mp3 -c:a pcm_s16le -ar:a 16000 -ac:a 1 -f wav -

  # some FFmpeg examples
  ffmpeg-video-h264: ffmpeg:virtual?video#video=h264
  ffmpeg-video-4K:   ffmpeg:virtual?video&size=4K#video=h264
  ffmpeg-video-10s:  ffmpeg:virtual?video&duration=10#video=h264
  ffmpeg-video-src2: ffmpeg:virtual?video=testsrc2&size=2K#video=h264

Documentation

Index

Constants

View Source
const SourceTemplate = "{input}"

Variables

This section is empty.

Functions

func AddPreload added in v1.9.11

func AddPreload(stream *Stream, rawQuery string) error

func AppendDOT added in v1.9.4

func AppendDOT(dot []byte, stream *Stream) []byte

func DecodeExecSource

func DecodeExecSource(source string) (string, error)

func DecodeSources

func DecodeSources(sources ...string) ([]string, error)

func DelPreload added in v1.9.11

func DelPreload(stream *Stream)

func Delete

func Delete(name string)

func FindPrefixURL

func FindPrefixURL(prefix string, sources []string) string

func FindPrefixURLs

func FindPrefixURLs(prefix string) map[string]*url.URL

func GetAllNames added in v1.9.9

func GetAllNames() []string

func GetAllSources added in v1.9.9

func GetAllSources() map[string][]string

func GetConsumer

func GetConsumer(url string) (core.Consumer, func(), error)

func GetProducer

func GetProducer(url string) (core.Producer, error)

func HandleConsumerFunc

func HandleConsumerFunc(scheme string, handler ConsumerHandler)

func HandleFunc

func HandleFunc(scheme string, handler Handler)

func HasPreload

func HasPreload(stream *Stream) bool

func HasProducer

func HasProducer(url string) bool

func Init

func Init()

func Location

func Location(url string) (string, error)

func MarkInsecure added in v1.9.12

func MarkInsecure(scheme string)

func ParseQuery

func ParseQuery(s string) url.Values

func Preload added in v1.9.11

func Preload(stream *Stream, rawQuery string)

func Publish

func Publish(stream *Stream, destination any)

func RedirectFunc

func RedirectFunc(scheme string, redirect Redirect)

func SupportedSchemes added in v1.9.12

func SupportedSchemes() []string

func Validate added in v1.9.3

func Validate(source string) error

Types

type ConsumerHandler

type ConsumerHandler func(url string) (core.Consumer, func(), error)

type Handler

type Handler func(source string) (core.Producer, error)

type Producer

type Producer struct {
	core.Listener
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(source string) *Producer

func (*Producer) AddTrack

func (p *Producer) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error

func (*Producer) Dial

func (p *Producer) Dial() error

func (*Producer) GetMedias

func (p *Producer) GetMedias() []*core.Media

func (*Producer) GetTrack

func (p *Producer) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)

func (*Producer) MarshalJSON

func (p *Producer) MarshalJSON() ([]byte, error)

func (*Producer) SetSource

func (p *Producer) SetSource(s string)

type Redirect

type Redirect func(url string) (string, error)

Redirect can return: location URL or error or empty URL and error

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func Get

func Get(name string) *Stream

func GetOrPatch

func GetOrPatch(query url.Values) (*Stream, error)

func New

func New(name string, sources ...string) (*Stream, error)

func NewStream

func NewStream(source any) *Stream

func Patch

func Patch(name string, source string) (*Stream, error)

func (*Stream) AddConsumer

func (s *Stream) AddConsumer(cons core.Consumer) (err error)

func (*Stream) AddInternalConsumer

func (s *Stream) AddInternalConsumer(conn core.Consumer)

func (*Stream) AddInternalProducer

func (s *Stream) AddInternalProducer(conn core.Producer)

func (*Stream) AddProducer

func (s *Stream) AddProducer(prod core.Producer)

func (*Stream) HasConsumer

func (s *Stream) HasConsumer(cons core.Consumer) bool

func (*Stream) MarshalJSON

func (s *Stream) MarshalJSON() ([]byte, error)

func (*Stream) Play

func (s *Stream) Play(urlOrProd any) error

func (*Stream) Publish

func (s *Stream) Publish(url string) error

func (*Stream) RemoveConsumer

func (s *Stream) RemoveConsumer(cons core.Consumer)

func (*Stream) RemoveInternalConsumer

func (s *Stream) RemoveInternalConsumer(conn core.Consumer)

func (*Stream) RemoveProducer

func (s *Stream) RemoveProducer(prod core.Producer)

func (*Stream) SetSource

func (s *Stream) SetSource(source string)

func (*Stream) Sources

func (s *Stream) Sources() []string

Jump to

Keyboard shortcuts

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