AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.21k stars 344 forks source link

Purpose and how to use Produce-stream API #1238

Open lucasmaj opened 2 months ago

lucasmaj commented 2 months ago

https://alexxit.github.io/go2rtc/api/#tag/Produce-stream

Please provide an example for the purpose/use case of this API.

Thanks

AlexxIT commented 2 months ago

https://github.com/AlexxIT/go2rtc#incoming-sources

xaionaro commented 1 month ago

Section "Incoming sources" has zero go2rtc config examples :(

AlexxIT commented 1 month ago

Example:

streams:
  camera1:

From docs:

You can push data only to existing stream (create stream with empty source in config)

xaionaro commented 1 month ago

Yes. This is basically what I tried before commenting about the absence of the config. If one writes config:

streams:
  camera1:

publish:
  camera1:
    - rtmp://127.0.0.1:1937/live

And then executes go2rtc, they get an error:

xaionaro@void:~/go/src/github.com/AlexxIT/go2rtc$ go run ./
10:57:22.776 INF go2rtc platform=linux/amd64 revision= version=1.9.4
10:57:22.776 INF config path=/home/xaionaro/go/src/github.com/AlexxIT/go2rtc/go2rtc.yaml
10:57:22.776 INF [rtsp] listen addr=:8554
10:57:22.776 INF [api] listen addr=:1984
10:57:22.776 INF [webrtc] listen addr=:8555/tcp
10:57:23.776 ERR internal/streams/publish.go:31 > error="streams: unknown error"
AlexxIT commented 1 month ago

You can't publish empty stream

xaionaro commented 1 month ago

Yes. But I intent to start streaming to this endpoint (e.g. using OBS) soon after running go2rtc (and hoping to get this stream re-published). I thought this was the use case intended by the support of "empty" sources.