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
7.29k stars 525 forks source link

Youtube Streaming issue #1176

Open teymur1988 opened 5 months ago

teymur1988 commented 5 months ago

Hi Alexx,

Could you please tell me why the following is not working:

I have a stream from the camera in H264 and AAC coming to go2rtc. I want to publish that stream to youtube. The config is as follows:

go2rtc version 1.9.3 (cd777ba) linux/amd64

go2rtc config:

streams:
  doorbell:
  - rtsp://admin:admin@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=0
  - ffmpeg:doorbell#audio=opus
  doorbell_sub:
  - rtsp://admin:admin@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1
  - ffmpeg:doorbell_sub#audio=opus
  - ffmpeg:doorbell_sub#video=mjpeg

webrtc:
  listen: :8555   # address of your local server (TCP)
  candidates:
  - public_ip:8555   # if you have dynamic public IP-address
ffmpeg:
  output: -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
api:
  origin: '*'
rtsp:
  listen: :8554
log:
  level: info # default level
  api: trace
  exec: debug
  rtsp: warn
  streams: trace
  webrtc: fatal

Command I issued to go2rtc:

curl -X POST "http://go2rtc.asus:1984/api/stream.mp4?src=doorbell_sub&dst=rtmp://a.rtmp.youtube.com/live2/{hidden-stream-key}"

go2rtc logs:

2024-06-09 11:45:15.951838994  11:45:15.951 TRC [api] POST /api/stream.mp4?src=doorbell_sub&dst=rtmp://a.rtmp.youtube.com/live2/{hidden-stream-key} 10.10.10.250:57806
2024-06-09 11:45:15.952045101  11:45:15.952 TRC [streams] check cons=0 media=video, sendonly, H264, H265
2024-06-09 11:45:15.952103599  11:45:15.952 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
2024-06-09 11:45:15.952186019  11:45:15.952 TRC [streams] match cons=0 <= prod=0
2024-06-09 11:45:15.952416283  11:45:15.952 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC
2024-06-09 11:45:15.952468114  11:45:15.952 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
2024-06-09 11:45:15.952517453  11:45:15.952 TRC [streams] check cons=0 prod=0 media=audio, recvonly, MPEG4-GENERIC/8000
2024-06-09 11:45:15.952554633  11:45:15.952 TRC [streams] match cons=0 <= prod=0
2024-06-09 11:45:15.952598081  11:45:15.952 TRC [streams] skip stop none producer
2024-06-09 11:45:15.952652008  11:45:15.952 TRC [streams] skip stop none producer
2024-06-09 11:45:17.139904280  11:45:17.139 TRC [streams] skip stop none producer
2024-06-09 11:45:17.140417380  11:45:17.140 TRC [streams] skip stop none producer

Nothing starts on youtube.

Stream is working fine in vlc:

Screenshot 2024-06-09 133731

I'm ready to provide any additional information on request. Thanks!

AlexxIT commented 5 months ago

You using wrong API. Check carefully URL

teymur1988 commented 5 months ago

I'm using this API from documentation: https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#publish-stream which says:

POST http://localhost:1984/api/streams?src=camera1&dst=rtmps://...

is this wrong?

teymur1988 commented 5 months ago

Ok, I see what you mean:

curl -X POST "http://go2rtc.asus:1984/api/streams?src=doorbell_sub&dst=rtmp://a.rtmp.youtube.com/live2/{hidden-stream-key}"

Changed the command now, nothing starts on youtube...

teymur1988 commented 5 months ago

Has anybody got this working this way?

AlexxIT commented 5 months ago

Check stream info. If stream is active. Also you can run this command from go2rtc WebUI.

teymur1988 commented 5 months ago

Don't matter where the command is issued from whether my terminal or the go2rtc UI, number of consumers for the stream becomes 2 for second and then becomes 1 again.

ps It's always 1 because frigate is always streaming it.

I ran a separate instance of go2rtc on windows just for this matter and here is the config and the logs: Number of consumers on windows is jumping from 0 to 1 and back to 0 (I guess the stream to youtube dies)

go2rtc windows config:

publish:
  xatai:
    - rtmp://a.rtmp.youtube.com/live2/3w8a-cgpz-5m2k-439u-4z4d
streams:
  xatai:
    - rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0

ffmpeg:
  output: -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
api:
  origin: '*'
rtsp:
  listen: :8554
log:
  level: trace # default level
  api: trace
  exec: trace
  ngrok: info
  rtsp: trace
  streams: trace
  webrtc: fatal

go2rtc windows logs: This message keeps looping... I also checked if I can see the stream in go2rtc ui (by clicking 'stream') or the local rtsp consumer (VLC) - all just fine. It's the youtube it can't send it to, I don't know why...

19:12:29.365 INF go2rtc platform=windows/amd64 revision=cd777ba version=1.9.3
19:12:29.370 DBG build vcs.time=2024-06-06T13:01:01Z version=go1.22.4
19:12:29.370 INF config path="C:\\go2rtc\\go2rtc.yaml"
19:12:29.372 TRC [api] register path path=/
19:12:29.374 TRC [api] register path path=/api
19:12:29.374 TRC [api] register path path=/api/config
19:12:29.375 TRC [api] register path path=/api/exit
19:12:29.381 TRC [api] register path path=/api/restart
19:12:29.382 TRC [api] register path path=/api/log
19:12:29.382 TRC [api] register path path=/api/ws
19:12:29.384 INF [api] listen addr=:1984
19:12:29.392 TRC [api] register path path=/api/streams
19:12:29.407 INF [rtsp] listen addr=:8554
19:12:29.419 TRC [api] register path path=/api/webrtc
19:12:29.436 TRC [api] register path path=/api/frame.mp4
19:12:29.438 TRC [api] register path path=/api/stream.mp4
19:12:29.441 TRC [api] register path path=/api/stream.m3u8
19:12:29.442 TRC [api] register path path=/api/hls/playlist.m3u8
19:12:29.445 TRC [api] register path path=/api/hls/segment.ts
19:12:29.447 TRC [api] register path path=/api/hls/init.mp4
19:12:29.447 TRC [api] register path path=/api/hls/segment.m4s
19:12:29.448 TRC [api] register path path=/api/frame.jpeg
19:12:29.448 TRC [api] register path path=/api/stream.mjpeg
19:12:29.449 TRC [api] register path path=/api/stream.ascii
19:12:29.449 TRC [api] register path path=/api/stream.y4m
19:12:29.450 TRC [api] register path path=/static
19:12:29.451 TRC [api] register path path=/streams
19:12:29.452 TRC [api] register path path=/stream/
19:12:29.453 TRC [hass] can't import config: open .storage/core.config_entries: The system cannot find the path specified.
19:12:29.454 TRC [api] register path path=/api/hass
19:12:29.454 TRC [api] register path path=/onvif/
19:12:29.455 TRC [api] register path path=/api/onvif
19:12:29.455 TRC [api] register path path=/api/webtorrent
19:12:29.457 TRC [api] register path path=/api/stream.flv
19:12:29.458 TRC [api] register path path=/api/ffmpeg
19:12:29.458 TRC [api] register path path=/api/ffmpeg/devices
19:12:29.458 TRC [api] register path path=/api/ffmpeg/hardware
19:12:29.459 TRC [api] register path path=/api/stream
19:12:29.460 TRC [api] register path path=/api/dvrip
19:12:29.460 TRC [api] register path path=/api/stream.ts
19:12:29.461 TRC [api] register path path=/api/stream.aac
19:12:29.462 TRC [api] register path path=/api/roborock
19:12:29.463 TRC [api] register path path=/api/homekit
19:12:29.463 TRC [api] register path path=/api/nest
19:12:29.464 TRC [api] register path path=/api/gopro
19:12:29.465 TRC [api] register path path=/api/stack
19:12:30.418 TRC [streams] check cons=0 media=video, sendonly, H264
19:12:30.450 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 1

19:12:30.469 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Cseq: 1
Www-Authenticate: Digest realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656"

19:12:30.473 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 2
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1", response="185ab85ea47cd06cb3fa19c2bcda6d97"

19:12:30.501 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cache-Control: must-revalidate
Content-Length: 582
Content-Type: application/sdp
Cseq: 2
X-Accept-Dynamic-Rate: 1
Content-Base: rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/

v=0
o=- 2252103006 2252103006 IN IP4 0.0.0.0
s=Media Server
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=packetization-supported:DH
a=rtppayload-supported:DH
a=range:npt=now-
m=video 0 RTP/AVP 96
a=control:trackID=0
a=framerate:5.000000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4D401E;sprop-parameter-sets=Z01AHqaAoD2QAA==,aO48gAA=
a=recvonly
m=audio 0 RTP/AVP 97
a=control:trackID=1
a=rtpmap:97 MPEG4-GENERIC/8000
a=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1588
a=recvonly

19:12:30.513 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:30.513 TRC [streams] match cons=0 <= prod=0
19:12:30.514 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0 RTSP/1.0
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0", response="60c468ffa94c71e0efcf0f59d8e6d372"
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3

19:12:30.543 TRC [rtsp] client response:
RTSP/1.0 200 OK
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=68D2FD24
X-Dynamic-Rate: 1
Cseq: 3
Session: 169693386894;timeout=60

19:12:30.545 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC
19:12:30.545 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:30.546 TRC [streams] check cons=0 prod=0 media=audio, recvonly, MPEG4-GENERIC/8000
19:12:30.546 TRC [streams] match cons=0 <= prod=0
19:12:30.547 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1 RTSP/1.0
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1", response="fa0e9e36655b1a6afa6b86eae77d33d7"
Session: 169693386894
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 4

19:12:30.563 TRC [rtsp] client response:
RTSP/1.0 200 OK
Session: 169693386894;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=1A7C63C5
X-Dynamic-Rate: 1
Cseq: 4

19:12:30.576 DBG [streams] start producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:30.577 TRC [rtsp] client request:
PLAY rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="ca2260d86801c7b73ab29f86fc05fd58"
Session: 169693386894
CSeq: 5

19:12:30.595 TRC [rtsp] client response:
RTSP/1.0 200 OK
Session: 169693386894
Rtp-Info: url=trackID=0;seq=57689;rtptime=2195999328,url=trackID=1;seq=37234;rtptime=1797533908
Cseq: 5

19:12:30.840 DBG [streams] stop producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:30.841 TRC [rtsp] client request:
TEARDOWN rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
CSeq: 6
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="0e8957f070e7fba5ab3bc6eea59bc656", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="9379204b50beabc350337de51d2ea384"
Session: 169693386894

19:12:30.843 TRC [streams] stop reconnect url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:35.845 TRC [streams] check cons=0 media=video, sendonly, H264
19:12:35.858 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 1

19:12:35.860 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Cseq: 1
Www-Authenticate: Digest realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41"

19:12:35.873 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1", response="1a0fb237be49f86ca134fb3f6a268b91"
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 2

19:12:35.892 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 2
X-Accept-Dynamic-Rate: 1
Content-Base: rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/
Cache-Control: must-revalidate
Content-Length: 582
Content-Type: application/sdp

v=0
o=- 2252103006 2252103006 IN IP4 0.0.0.0
s=Media Server
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=packetization-supported:DH
a=rtppayload-supported:DH
a=range:npt=now-
m=video 0 RTP/AVP 96
a=control:trackID=0
a=framerate:5.000000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4D401E;sprop-parameter-sets=Z01AHqaAoD2QAA==,aO48gAA=
a=recvonly
m=audio 0 RTP/AVP 97
a=control:trackID=1
a=rtpmap:97 MPEG4-GENERIC/8000
a=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1588
a=recvonly

19:12:35.906 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:35.907 TRC [streams] match cons=0 <= prod=0
19:12:35.907 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0", response="1b64afc0be616ee4cd690ed01c3d5b15"

19:12:35.923 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Session: 169698778420;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=68D2FD24
X-Dynamic-Rate: 1

19:12:35.937 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC
19:12:35.946 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:35.947 TRC [streams] check cons=0 prod=0 media=audio, recvonly, MPEG4-GENERIC/8000
19:12:35.947 TRC [streams] match cons=0 <= prod=0
19:12:35.948 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 4
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1", response="b4dd081acfaf47d2a3783015167a44e3"
Session: 169698778420

19:12:35.971 TRC [rtsp] client response:
RTSP/1.0 200 OK
X-Dynamic-Rate: 1
Cseq: 4
Session: 169698778420;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=1A7C63C5

19:12:35.985 DBG [streams] start producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:35.985 TRC [rtsp] client request:
PLAY rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
CSeq: 5
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="8b5a4b2684071944d300936f1a17bdf6"
Session: 169698778420

19:12:36.002 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 5
Session: 169698778420
Rtp-Info: url=trackID=0;seq=57755;rtptime=2196487128,url=trackID=1;seq=37276;rtptime=1797576916

19:12:36.426 DBG [streams] stop producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:36.427 TRC [rtsp] client request:
TEARDOWN rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
CSeq: 6
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="7caf89f84064605d709bd39d47ae3a41", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="3117cdfec0eb3970ae05eb39e06aa5f1"
Session: 169698778420

19:12:36.428 TRC [streams] stop reconnect url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:41.434 TRC [streams] check cons=0 media=video, sendonly, H264
19:12:41.458 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 1

19:12:41.481 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Www-Authenticate: Digest realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda"
Cseq: 1

19:12:41.490 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 2
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1", response="2d28965348bb6828971301875d796a39"

19:12:41.501 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 2
X-Accept-Dynamic-Rate: 1
Content-Base: rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/
Cache-Control: must-revalidate
Content-Length: 582
Content-Type: application/sdp

v=0
o=- 2252103006 2252103006 IN IP4 0.0.0.0
s=Media Server
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=packetization-supported:DH
a=rtppayload-supported:DH
a=range:npt=now-
m=video 0 RTP/AVP 96
a=control:trackID=0
a=framerate:5.000000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4D401E;sprop-parameter-sets=Z01AHqaAoD2QAA==,aO48gAA=
a=recvonly
m=audio 0 RTP/AVP 97
a=control:trackID=1
a=rtpmap:97 MPEG4-GENERIC/8000
a=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1588
a=recvonly

19:12:41.511 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:41.511 TRC [streams] match cons=0 <= prod=0
19:12:41.512 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=0", response="24dd1fea0708b9e05810f43ece4bd85f"

19:12:41.532 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Session: 169704386362;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=68D2FD24
X-Dynamic-Rate: 1

19:12:41.545 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC
19:12:41.546 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
19:12:41.547 TRC [streams] check cons=0 prod=0 media=audio, recvonly, MPEG4-GENERIC/8000
19:12:41.547 TRC [streams] match cons=0 <= prod=0
19:12:41.548 TRC [rtsp] client request:
SETUP rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1 RTSP/1.0
Session: 169704386362
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 4
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/trackID=1", response="b38dbb0264780fec2498c5b4beb5d83c"

19:12:41.564 TRC [rtsp] client response:
RTSP/1.0 200 OK
X-Dynamic-Rate: 1
Cseq: 4
Session: 169704386362;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=1A7C63C5

19:12:41.576 DBG [streams] start producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:41.577 TRC [rtsp] client request:
PLAY rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
Session: 169704386362
CSeq: 5
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="db65ab6576c1cc07bc0fa37cef4ded02"

19:12:41.595 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 5
Session: 169704386362
Rtp-Info: url=trackID=0;seq=57822;rtptime=2196992928,url=trackID=1;seq=37320;rtptime=1797621812

19:12:42.017 DBG [streams] stop producer url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:42.018 TRC [rtsp] client request:
TEARDOWN rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/ RTSP/1.0
CSeq: 6
Authorization: Digest username="admin", realm="Login to 5846c3a930530ae89928cf1c0f5af817", nonce="f331394c782ee7f766bcb4c70002fdda", uri="rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1/", response="f3c1c24f7938defa26340b8b7fba16b9"
Session: 169704386362

19:12:42.019 TRC [streams] stop reconnect url=rtsp://admin:{edited}@doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1#backchannel=0
19:12:47.032 TRC [streams] check cons=0 media=video, sendonly, H264
19:12:47.051 TRC [rtsp] client request:
DESCRIBE rtsp://doorbellcamera.asus/cam/realmonitor?channel=1&subtype=1 RTSP/1.0
Accept: application/sdp
User-Agent: go2rtc/1.9.3
CSeq: 1

What else can I check?

teymur1988 commented 5 months ago

Update: Something must be broken in the current version. because I downloaded version 1.8.3 and youtube live started working

teymur1988 commented 5 months ago

Update: Last version that Youtube streaming works on is 1.9.2

Current version also has another bug:

With the following config:

streams:
  xatai:
    - rtsp://admin:parol@vstarcam.xatai/tcp/av0_1
    - ffmpeg:xatai#audio=aac
    - ffmpeg:xatai#audio=opus
ffmpeg:
  output: -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
api:
  origin: '*'
rtsp:
  listen: :554
log:
  level: trace # default level
  api: trace
  exec: trace
  ngrok: info
  rtsp: info
  streams: trace
  webrtc: fatal

When launching VLC and trying to stream like rtsp://localhost/xatai?video=all&audio=all, the AAC audio doesn't come in all the others (PCM - camera native, OPUS - transcoded) do. AAC audio also doesn't come in if I request just it rtsp://localhost/xatai?video=all&audio=aac, there will be no audio at all.

teymur1988 commented 5 months ago

Hi Alex,

I have another question:

Once I issued the command to publish stream to youtube like:

POST http://localhost:1984/api/streams?src=camera1&dst=rtmp://xxx.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx-xxxx

go2rtc will keep publishing this stream until I restart go2rtc. Is there a way to stop this stream via http api?

I tried like this with empty source but it kept publishing the stream:

POST http://localhost:1984/api/streams?src=''&dst=rtmp://xxx.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx-xxxx

AlexxIT commented 5 months ago

There is no API to stop yet

teymur1988 commented 5 months ago

Would be very useful if there was one.

NarkyAbyss commented 4 months ago

I appear to be having the same issue on 1.9.4

$ curl -i -X POST http://192.168.1.xxx:1984/api/streams?src=test0&dst=rtmps://a.rtmp.youtube.com/live2/<stream_key>
[1] 23
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Tue, 16 Jul 2024 15:22:12 GMT
Content-Length: 1

http://192.168.1.xxx:1984/links.html?src=test0 Publish stream "send" doesnt seem to do anything

Here's my config

publish:
    test0:
    - rtmps://a.rtmp.youtube.com:443/live2/<stream_key>

streams:
    test0: ffmpeg:rtsp://192.168.1.yyy/ch0_0.h264#video=copy#audio=aac

log:
    publish: debug
tokenwizard commented 2 months ago

I can confirm the same behavior on 1.9.4 via Docker. Stream viewers increases by 1 for a second or so and then drops back down as the YT feed fails.

switching back to 1.92, when I publish the stream, it shows the watcher count go up and stay up, but YT never gets the stream. It just sits like this indefinitely. image

image

Here is my publish command:

curl -i -X POST "http://192.168.12.58:1984/api/streams?src=StreetRight&dst=rtmp://a.rtmp.youtube.com/live2/<redacted-stream-key>"
HTTP/1.1 200 OK
Date: Thu, 26 Sep 2024 16:38:21 GMT
Content-Length: 0

In the logs, it does not seem to be showing any errors. Here is the moment that it posts the video to YouTube:

go2rtc-1  | 13:02:27.397 TRC [api] POST /api/streams?src=StreetRight&dst=rtmp://a.rtmp.youtube.com/live2/<stream_id_redacted> 192.168.12.128:37588
go2rtc-1  | 13:02:27.397 TRC [streams] check cons=0 media=video, sendonly, H264
go2rtc-1  | 13:02:27.451 TRC [streams] check cons=0 prod=0 media=video, recvonly, H.264 Main 4.0
go2rtc-1  | 13:02:27.451 TRC [streams] match cons=0 <= prod=0
go2rtc-1  | 13:02:27.485 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC
go2rtc-1  | 13:02:27.485 TRC [streams] check cons=0 prod=0 media=video, recvonly, H.264 Main 4.0
go2rtc-1  | 13:02:27.485 DBG [streams] start producer url=rtsp://192.168.12.101:554/cam/realmonitor?channel=1&subtype=0
go2rtc-1  | 13:02:27.498 TRC [api] GET /api/streams 192.168.12.128:48990
go2rtc-1  | 13:02:28.507 TRC [api] GET /api/streams 192.168.12.128:48990
tokenwizard commented 2 months ago

YouTube Live Streams work from other publishing software. I just fired up a fresh instance of Oryx via Docker and plugged my direct RTSP stream from the camera along with the same stream URL/Key I tried with Go2RTC and it works fine.

When I instead pass Oryx the RTSP Stream link generated by Go2RTC, it does work as well. So this seems to indicate an issue with the API config or something that needs to be tweaked in the curl/POST command?