GithubHelp home page GithubHelp logo

rtsptowebrtc's Introduction

RTSPtoWebRTC

RTSP Stream to WebBrowser over WebRTC based on Pion (full native! not using ffmpeg or gstreamer).

Note: RTSPtoWeb is an improved service that provides the same functionality, an improved API, and supports even more protocols. RTSPtoWeb is recommended over using this service.

if you need RTSPtoWSMP4f use https://github.com/deepch/RTSPtoWSMP4f

RTSPtoWebRTC image

Download Source

  1. Download source
    $ git clone https://github.com/deepch/RTSPtoWebRTC  
  2. CD to Directory
     $ cd RTSPtoWebRTC/
  3. Test Run
     $ GO111MODULE=on go run *.go
  4. Open Browser
    open web browser http://127.0.0.1:8083 work chrome, safari, firefox

Configuration

Edit file config.json

format:

{
  "server": {
    "http_port": ":8083"
  },
  "streams": {
    "demo1": {
      "on_demand" : false,
      "url": "rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"
    },
    "demo2": {
      "on_demand" : true,
      "url": "rtsp://admin:[email protected]/mpeg4"
    },
    "demo3": {
      "on_demand" : false,
      "url": "rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"
    }
  }
}

Livestreams

Use option "on_demand": false otherwise you will get choppy jerky streams and performance issues when multiple clients connect.

Limitations

Video Codecs Supported: H264

Audio Codecs Supported: pcm alaw and pcm mulaw

Team

Deepch - https://github.com/deepch streaming developer

Dmitry - https://github.com/vdalex25 web developer

Now test work on (chrome, safari, firefox) no MAC OS

Other Example

Examples of working with video on golang

paypal.me/AndreySemochkin - You can make one-time donations via PayPal. I'll probably buy a coffee tea. 🍵

rtsptowebrtc's People

Contributors

alexxit avatar allenporter avatar crstian19 avatar daozhao avatar deepch avatar dependabot[bot] avatar devirex avatar emalton avatar fourleaftec avatar osos avatar renovate-bot avatar renovate[bot] avatar travishaagen avatar vdalex25 avatar yaba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtsptowebrtc's Issues

"Fix Format may be raw PCM 97 97"

I have an RTSP server where I modified a standard h264 main profile with aac audio stream using:

ffmpeg -rtsp_transport udp -i rtsp://10.0.0.10/main -vcodec copy -acodec pcm_alaw -f rtsp rtsp://....

When the RTSPtoWebRTC connects to the stream it outputs "Fix Format may be raw PCM 97 97" then says "exit status 1" and stops. I've tested the stream with VLC and it plays video/audio. I've also tried pcm_mulaw with the same message. ffmpeg supports a lot of PCM variants. https://trac.ffmpeg.org/wiki/audio%20types

Not sure what the raw PCM 97 97 refers to exactly.

I should point out that RTSPtoWebRTC plays the video fine with the original rtsp://10.0.0.10/main stream and drops the aac audio as expected. (I need audio though which is why I'm jumping through this hoop of converting it).

peerConnection.SetRemoteDescription failed with "failed to parse IP address"

Your environment.

  • Version:

github.com/pion/webrtc/v2 v2.0.12 h1:76s5SXtX0YEcnbGD95rfXe2yOc3FvW7vxjCo3NqTuLM=
github.com/pion/webrtc/v2 v2.0.12/go.mod h1:O6ussUkKHJHV95xboN67X/t99jtejCWo/eRuw7viM6w=

  • Browser: chrome 77.0.3865.90(linux)
  • Other Information - firefox

What did you do?

I run you main.go to receive the post request to get the sdp.

peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{
		ICEServers: []webrtc.ICEServer{
			{
				URLs: []string{"stun:116.55.227.21:3478","turn:116.55.227.21:3478"},
				Username: "xxx",
				Credential:"xxx",
				CredentialType:webrtc.ICECredentialTypePassword,
			},
		},
	})
	if err != nil {
		panic(err)
	}
	peerConnection.OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) {
		fmt.Printf("Connection State has changed %s \n", connectionState.String())
	})
	vp8Track, err := peerConnection.NewTrack(webrtc.DefaultPayloadTypeH264, rand.Uint32(), "video", "pion2")
	if err != nil {
		log.Println("1",err)
		return
	}
	_, err = peerConnection.AddTrack(vp8Track)
	if err != nil {
		log.Println("2",err)
		return
	}
	// Allow us to receive 1 audio track, and 2 video tracks
	if _, err = peerConnection.AddTransceiver(webrtc.RTPCodecTypeAudio); err != nil {
		panic(err)
	} else if _, err = peerConnection.AddTransceiver(webrtc.RTPCodecTypeVideo); err != nil {
		panic(err)
	} else if _, err = peerConnection.AddTransceiver(webrtc.RTPCodecTypeVideo); err != nil {
		panic(err)
	}
	offer := webrtc.SessionDescription{
		Type: webrtc.SDPTypeOffer,
		SDP:  string(sd),
	}
	log.Println(offer)
	if err := peerConnection.SetRemoteDescription(offer); err != nil {
		log.Println("step 3",err)
		return
	}
	answer, err := peerConnection.CreateAnswer(nil)
	if err != nil {
		log.Println("4",err)
		return
	}

and a js

pc.createOffer({offerToReceiveVideo: true, offerToReceiveAudio: true}).then(d => pc.setLocalDescription(d)).catch(log)
pc.onicecandidate = event => {
  if (event.candidate === null) {
    document.getElementById('localSessionDescription').value = btoa(pc.localDescription.sdp)
    $.post("/recive", { data:btoa(pc.localDescription.sdp)} ,function(data){
      document.getElementById('remoteSessionDescription').value = data
      window.startSession()
    });
  }
}

What did you expect?

works on chrome

What happened?

it works on firefox 69.0.1, but failed on chrome 77.0.3865.90(linux) on step 3, with error "failed to parse IP address"

here is sdp offer from chrome:

/tmp/___go_build_github_com_deepch_RTSPtoWebRTC #gosetup
2019/09/26 16:37:47 {offer v=0
o=- 8756874911779966808 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:3257267946 1 udp 2113937151 83b4f79b-2bf8-4791-ba77-a63210c4b0a8.local 59380 typ host generation 0 network-cost 999
a=ice-ufrag:GGyZ
a=ice-pwd:BsewdZxOX7u0bV/HIbnyzp16
a=ice-options:trickle
a=fingerprint:sha-256 AA:8B:C9:68:3C:CB:BB:7E:F2:F5:FA:AA:57:DB:16:D1:F5:5F:D3:A4:F1:5B:39:BB:7F:32:11:4C:73:37:66:17
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:3257267946 1 udp 2113937151 83b4f79b-2bf8-4791-ba77-a63210c4b0a8.local 45218 typ host generation 0 network-cost 999
a=ice-ufrag:GGyZ
a=ice-pwd:BsewdZxOX7u0bV/HIbnyzp16
a=ice-options:trickle
a=fingerprint:sha-256 AA:8B:C9:68:3C:CB:BB:7E:F2:F5:FA:AA:57:DB:16:D1:F5:5F:D3:A4:F1:5B:39:BB:7F:32:11:4C:73:37:66:17
a=setup:actpass
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:12 urn:3gpp:video-orientation
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP9/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 profile-id=2
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 red/90000
a=rtpmap:120 rtx/90000
a=fmtp:120 apt=124
a=rtpmap:123 ulpfec/90000
 <nil>}
2019/09/26 16:37:47 3 failed to parse IP address

here is the sdp offer from firefox:

2019/09/26 16:49:16 {offer v=0
o=mozilla...THIS_IS_SDPARTA-69.0.1 1219220930751714801 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 08:3C:6F:D7:2D:15:3F:F8:0A:90:DD:2D:AE:95:85:41:CD:59:1C:95:53:44:35:57:26:F9:12:D3:25:F3:67:9F
a=group:BUNDLE 0 1
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 38489 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 10.1.14.151
a=candidate:0 1 UDP 2122252543 10.1.14.151 38489 typ host
a=candidate:1 1 TCP 2105524479 10.1.14.151 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 10.1.14.151 48054 typ host
a=candidate:1 2 TCP 2105524478 10.1.14.151 9 typ host tcptype active
a=recvonly
a=end-of-candidates
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:705901f774e42ed032dc898dab33dda1
a=ice-ufrag:b6192bbe
a=mid:0
a=rtcp:48054 IN IP4 10.1.14.151
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:1044295777 cname:{c0b3ff8d-bc09-498f-8d3b-1f2236d6711a}
m=video 34499 UDP/TLS/RTP/SAVPF 120 121 126 97
c=IN IP4 10.1.14.151
a=candidate:0 1 UDP 2122252543 10.1.14.151 34499 typ host
a=candidate:1 1 TCP 2105524479 10.1.14.151 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 10.1.14.151 52308 typ host
a=candidate:1 2 TCP 2105524478 10.1.14.151 9 typ host tcptype active
a=recvonly
a=end-of-candidates
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:121 max-fs=12288;max-fr=60
a=ice-pwd:705901f774e42ed032dc898dab33dda1
a=ice-ufrag:b6192bbe
a=mid:1
a=rtcp:52308 IN IP4 10.1.14.151
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=rtpmap:126 H264/90000
a=rtpmap:97 H264/90000
a=setup:actpass
a=ssrc:1641747560 cname:{c0b3ff8d-bc09-498f-8d3b-1f2236d6711a}
 <nil>}
Connection State has changed checking 

ICE connection state changes to "Disconnected" 30 seconds after it connected in complex NAT

Your environment.

  • Version: pion/webrtc v2.2.24
  • Browser: chrome 86.0.4240.111 64bit
  • Other Information
    turn server(gortcd) config
peerConnection, err := api.NewPeerConnection(webrtc.Configuration{
			ICEServers: []webrtc.ICEServer{

				{
					URLs: []string{"turn:xxx.xxx.xxx.xxx:3478"},
					Username: "webrtc",
					Credential:"google",
					CredentialType:webrtc.ICECredentialTypePassword,
				},
			},
		})

What did you do?

I just run the https://github.com/deepch/RTSPtoWebRTC lastest version

deploy it a public ip server, when my browser and RTSPtoWebRTC server in the same LAN, it works normally.

when I open the browser in the other network env, it can open the webrtc vedio stream, the data channel is ok, but it will disconnected in 30 seconds.

What did you expect?

it works or give some tips how to work around.

What happened?

server side log:

2020/10/30 21:51:46 Connection State has changed connected 
2020/10/30 21:51:46 complete
2020/10/30 21:51:46 start stream HQ-3 client 7F5EB57B-2EC8-D515-9BC5-A46E1F4D0CE3
2020/10/30 21:52:17 Client Close Keep-Alive Timer
2020/10/30 21:52:17 Connection State has changed closed 
2020/10/30 21:52:17 complete
2020/10/30 21:52:17 Client Close Exit
2020/10/30 21:52:17 stop stream HQ-3 client 7F5EB57B-2EC8-D515-9BC5-A46E1F4D0CE3

chrome browser log:

add video Transceiver
checking
1 track is delivered
connected
disconnected

chrome webrtc internal

Time	Event
2020/10/30 9:51:46	
createLocalDataChannel
2020/10/30 9:51:46	negotiationneeded
2020/10/30 9:51:46	
createOffer
2020/10/30 9:51:46	
createOfferOnSuccess
2020/10/30 9:51:46	
setLocalDescription
2020/10/30 9:51:46	
transceiverModified
2020/10/30 9:51:46	
signalingstatechange
2020/10/30 9:51:46	setLocalDescriptionOnSuccess
2020/10/30 9:51:46	
icegatheringstatechange
2020/10/30 9:51:46	
icecandidateerror
2020/10/30 9:51:46	
icecandidateerror
2020/10/30 9:51:46	
icecandidate (host)
2020/10/30 9:51:46	
icecandidate (host)
2020/10/30 9:51:46	
icecandidate (srflx)
2020/10/30 9:51:46	
icecandidate (srflx)
2020/10/30 9:51:46	
setRemoteDescription
2020/10/30 9:51:46	
iceconnectionstatechange
2020/10/30 9:51:46	
transceiverModified
2020/10/30 9:51:46	
signalingstatechange
2020/10/30 9:51:46	setRemoteDescriptionOnSuccess
2020/10/30 9:51:46	
iceconnectionstatechange (legacy)
2020/10/30 9:51:46	
connectionstatechange
2020/10/30 9:51:46	
icecandidate (relay)
2020/10/30 9:51:46	
icegatheringstatechange
2020/10/30 9:51:46	
iceconnectionstatechange
2020/10/30 9:51:46	
iceconnectionstatechange (legacy)
2020/10/30 9:51:46	
connectionstatechange
2020/10/30 9:52:01	
iceconnectionstatechange (legacy)
completed
2020/10/30 9:52:16	
iceconnectionstatechange
2020/10/30 9:52:16	
iceconnectionstatechange (legacy)
connected
2020/10/30 9:52:16	
iceconnectionstatechange (legacy)
failed
2020/10/30 9:52:16	
connectionstatechange
failed

Multiple client do not work and it does not work in firefox.

Thank you for thank you for great work. I run multiple client (Google chrome) when new window opened, old window disconnect and do not show video. I receive error in firefox InvalidSessionDescriptionError: Answer tried to set recv when offer did not set send. Please help me.

Home Assistant (hass.io) addon

Hi. I developed hass.io addon based on your project:

https://github.com/AlexxIT/hassio-addons/tree/master/rtsp2webrtc

It's support Ingress (proxy for addon web interface via Home Assistant) and external access to cameras.

I made two changes:

  • change absolute web paths to relatives, need for support ingress
  • set fixed UDP port range, so users can port forward it in router

I plan to add port range setting in config (or you can do this).

And need someone to make a lovelace card to support this addon.

I really look forward to your support for other codecs, if possible. I'm not a video expert.

You can read more in my blog on russian.

Make it work in a different service using js only

I want to use this great project as a service that I'm installing in a computer, and create another service in js (React in my case) and publish this front-end to a cloud for example.

I don't familiar with Go so can someone help me in how to create a service that will connect to this Go service?

Something like that:

  1. go . run (service 1 on port xxx)
  2. npm start (service 2 on port yyy)

Thanks

pion webrct v2 missing

If I will get the packed I become this errror:
go get github.com/deepch/RTSPtoWebRTC
package github.com/pion/webrtc/v2: cannot find package "github.com/pion/webrtc/v2" in any of:
/usr/lib/go-1.10/src/github.com/pion/webrtc/v2 (from $GOROOT)
/root/go/src/github.com/pion/webrtc/v2 (from $GOPATH)

"crypto/ed25519": missing dot in first path element

I'm getting it with go version go1.13.3 darwin/amd64

    go: finding github.com/pborman/uuid v1.2.0
    build github.com/micro/micro: cannot load crypto/ed25519: malformed module path "crypto/ed25519": missing dot in first path element

Concurrent use issue

I'm trying to use the repository to connect multiple cameras (using RTSP), keeping different instances of the executable running, but often there is a connection problem or on the second attempt the previous connection is closed.

image

Another problem is disconnecting the RTCDatachannel after a few minutes, reporting message:

adapter-latest.js:1461 Uncaught DOMException: Failed to execute 'send' on 'RTCDataChannel': RTCDataChannel.readyState is not 'open'

Do you have any suggestions for a solution to the problem?

Regards

demo1 rtsp: codec data change, please call HandleCodecDataChange()

detailed log

OPTIONS rtsp://192.168.1.100:554/test RTSP/1.0
CSeq: 1

DESCRIBE rtsp://192.168.1.100:554/test RTSP/1.0
CSeq: 2
Accept: application/sdp

< v=0
o=- 0 0 IN IP4 127.0.0.1
s=Media Presentation
c=IN IP4 192.168.1.100
t=0 0
a=tool:libavformat 58.46.101
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LglageAIn5UA==,aM4wpIA=; profile-level-id=42E095
a=control:streamid=0

SETUP rtsp://192.168.1.100:554/test/streamid=0 RTSP/1.0
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: cAa2lnZMg

PLAY rtsp://192.168.1.100:554/test RTSP/1.0
CSeq: 4
Session: cAa2lnZMg
2020/06/18 14:34:54 demo1 rtsp: codec data change, please call HandleCodecDataChange()
2020/06/18 14:34:54 demo1 reconnect wait 5s
2020/06/18 14:34:59 demo1 connect rtsp://192.168.1.100/test

Help to understand code flow

I want to implement WebRTC streaming in js but its difficult for me to understand the code flow in go . Can you guide me through it or provide a link which could help to implement it in js?

when run one day it throw erro:panic: runtime error: makeslice: len out of range

the erro log

panic: runtime error: makeslice: len out of range

goroutine 19 [running]:
github.com/deepch/vdk/format/rtsp.(*Client).findRTSP(0xc0004b4000, 0xc000012500, 0x2406, 0x2500, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:443 +0x75a
github.com/deepch/vdk/format/rtsp.(*Client).poll(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:536 +0x7d
github.com/deepch/vdk/format/rtsp.(*Client).readPacket(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1204 +0x84
github.com/deepch/vdk/format/rtsp.(*Client).ReadPacket(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x140, 0x150)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1228 +0x90
main.serveStreams.func1(0xc00012a886, 0x2, 0xc00016e180, 0x40)
	/Users/glasssky001/GitHub/RTSPtoWebRTC/stream.go:36 +0x484
created by main.serveStreams
	/Users/glasssky001/GitHub/RTSPtoWebRTC/stream.go:12 +0x12c

this is our rtsp stream adress

"rtsp://admin:[email protected]:50019/h264/ch1/main/av_stream"

my test config.json

{
  "server": {
    "http_port": ":8083"
  },
  "streams": {

  "c3": {
      "url": "rtsp://admin:[email protected]:50019/h264/ch1/main/av_stream"
    }
  }
}

.\main.go:17:5: undefined: StartHTTPServer

Can you help me build it or relase a config able exe?

command-line-arguments

.\main.go:17:5: undefined: StartHTTPServer
.\main.go:32:6: undefined: videoTrack
.\main.go:33:4: undefined: videoTrack

图片

codec error

I'm getting a codec error when using this public RTSP url: rtsp://wowzaec2demo.streamlock.net:554/vod/mp4:BigBuckBunny_115k.mov

    2020/10/13 13:38:19 Request demo1
    2020/10/13 13:38:19 Codec error
    [GIN] 2020/10/13 - 13:38:19 | 200 |     451.752µs |             ::1 | POST     "/recive"
    [GIN] 2020/10/13 - 13:38:19 | 404 |         859ns |             ::1 | GET      "/favicon.ico"
    rtp: keep alive
    > OPTIONS rtsp://wowzaec2demo.streamlock.net:554/vod/mp4:BigBuckBunny_115k.mov RTSP/1.0

This is the config

    {
      "server": {
        "http_port": ":8083"
      },
      "streams": {
        "demo1": {
          "url": "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
        }
      }
    }

only play about 90s

I can only play about 90s in chrome , win7 64.
the server run RTSPtoWebRTC is ubuntu16.04.
after about 90s , the rtsp block when recv data.

the memstates:

# runtime.MemStats
# Alloc = 1647176
# TotalAlloc = 387560432
# Sys = 74531072
# Lookups = 0
# Mallocs = 225300
# Frees = 211016
# HeapAlloc = 1647176
# HeapSys = 66453504
# HeapIdle = 63225856
# HeapInuse = 3227648
# HeapReleased = 61644800
# HeapObjects = 14284
# Stack = 655360 / 655360
# MSpan = 103224 / 131072
# MCache = 13888 / 16384
# BuckHashSys = 1452096
# GCSys = 3574024
# OtherSys = 2248632
# NextGC = 4194304
# LastGC = 1590235987249575400
# PauseNs = [52685 45903 41451 51357 32091 48652 32797 29863 63450 38877 106442 36011 55745 44759 34776 36170 29226 33505 26539 52179 28526 38291 35010 30148 39646 82183 68376 31245 64781 45304 56932 31281 32639 39458 31626 30422 67281 55369 31062 24746 69002 34182 22979 127799 27227 39713 83875 64533 57403 44558 27653 49628 35158 25833 88610 70486 26514 35207 53641 55239 30609 34168 71951 32055 35298 43254 29616 30579 47310 114873 28747 59611 60195 28382 33485 30356 31475 34876 29332 31075 34560 29321 32147 31840 33709 34907 25443 29710 29847 44440 55872 51079 36623 31620 90692 29610 63122 44297 34255 94506 32037 119398 46551 66319 36987 40183 37314 76868 63443 60145 87338 32743 32473 40498 30460 70378 33326 32292 28894 29375 44916 31261 73734 28991 44179 71228 29613 38298 41485 43976 51076 29439 38692 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# PauseEnd = [1590235922529127781 1590235923009672173 1590235923448727085 1590235923848936523 1590235924249235200 1590235924648575224 1590235925050392532 1590235925488095395 1590235925889266376 1590235926328529166 1590235926689649471 1590235927090011616 1590235927689173660 1590235928528628926 1590235929288942063 1590235930089048271 1590235930648203663 1590235931130285663 1590235931568537534 1590235931969914806 1590235932370283293 1590235932809374247 1590235933208792125 1590235933610279096 1590235934049057154 1590235934449260390 1590235934848922673 1590235935173029051 1590235935929414182 1590235936728955912 1590235937489064918 1590235938169299297 1590235938689237212 1590235939169158350 1590235939568971265 1590235939929847365 1590235940329737090 1590235940729248873 1590235941129757594 1590235941568610288 1590235941928920573 1590235942328998457 1590235942688740905 1590235943088515752 1590235943608607082 1590235944408433020 1590235945089581906 1590235945849165144 1590235946448332628 1590235946968727262 1590235947369487998 1590235947769735113 1590235948169569760 1590235948568532230 1590235949008347154 1590235949370065463 1590235949769826214 1590235950170007805 1590235950568863475 1590235950930244491 1590235951248811127 1590235952089108117 1590235952769203328 1590235953529425190 1590235954208347821 1590235954688352265 1590235955169541471 1590235955570099933 1590235955968675650 1590235956368648050 1590235956769900644 1590235957169761138 1590235957609433184 1590235958010023131 1590235958409548225 1590235958770068294 1590235959169260366 1590235959809728567 1590235960648485543 1590235961329305353 1590235962089675397 1590235962568159016 1590235963009826411 1590235963409394778 1590235963809753099 1590235964209823477 1590235964609296722 1590235965010032820 1590235965448809479 1590235965888863021 1590235966250292099 1590235966609414228 1590235966969998468 1590235967448866372 1590235968289255398 1590235969048762557 1590235969806580499 1590235970370554706 1590235970810303366 1590235971250262667 1590235971650651472 1590235972048773827 1590235972409725968 1590235972849094764 1590235973209750351 1590235973608962032 1590235974049224237 1590235974410030317 1590235974769393589 1590235975169760196 1590235975809649299 1590235976608654301 1590235977249221100 1590235977969299557 1590235978568140858 1590235979008884543 1590235979408027435 1590235979770097943 1590235980169941513 1590235980529705738 1590235980968728720 1590235981368906903 1590235981769583525 1590235982169839696 1590235982569366172 1590235982968993198 1590235983368868387 1590235984168938961 1590235984968521072 1590235985728864017 1590235986369610350 1590235986809945390 1590235987249575400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# NumGC = 133
# NumForcedGC = 0
# GCCPUFraction = 0.0004086961125018299
# DebugGC = false

SSL / HTTPS

A solution to run through HTTPS / SSL ?

Website on Apache with SSL certificate...
Apache proxy ?

I try to test Webrtc player on webpage but Chrome refuse because of mixed content ..

Thank.

Stream not playing

Screenshot (29)
Screenshot (29)
Screenshot (30)
Screenshot (31)

Hi,
The stream is not playing in the browser, it checks the connection state and also that the track is delivered and then it says connected but there is no stream playing. Can you please help me! Please find my outputs attached
Thank you

Go over remote server

I run this project on a windows server.
locally it works great but when I'm going from different network the page is displayed and everything is fine except the video that not showing up.

No error and no "sendChannel has opened" message.

Any ideas?

Question: how mature is this project?

I came across this project and I'm all excited: rtsp to webrtc is exactly what I need.

I made a fork of this repo to see how I could integrate it with a React based webapp.

While I do get things up and running, I have observed some behavior that makes me scratch my head: When I'm trying to display multiple (~ 2-4) streams in the browser, I sometimes have to re-initialize the PeerConnection several times in order to establish the stream. Any ideas why that might be?

And a general question about the state of the project: Is this a proof of concept? Is this something that you're using in production?

Thanks!

cannot find module for path crypto/ed25519

Hi! Trying to go run . command on RPI4, and eventually it fails with this error:

build github.com/deepch/RTSPtoWebRTC: cannot find module for path crypto/ed25519

Can you help please?

Compability issue: "Video might not work with codec 102"- Hikvision camera unit

When I run the code together with my hikvision camera stream/record unit I get the following log:

[GIN] 2020/08/07 - 11:58:10 | 200 | 291.505µs | 94.254.117.91 | GET "/player/demo1"
[GIN] 2020/08/07 - 11:58:10 | 200 | 99.604µs | 94.254.117.91 | GET "/static/js/app.js?ver=2020-08-07%2011%3a58%3a10.432590088%20%2b0000%20UTC%20m%3d%2b91.940309803"
2020/08/07 11:58:10 Write Codec Info error
[GIN] 2020/08/07 - 11:58:10 | 200 | 76.524µs | 94.254.117.91 | GET "/codec/demo1"
2020/08/07 11:58:10 Request demo1
2020/08/07 11:58:10 Video might not work with codec 102
2020/08/07 11:58:10 Work payloadType 102
[GIN] 2020/08/07 - 11:58:10 | 200 | 20.06585ms | 94.254.117.91 | POST "/recive"
2020/08/07 11:58:20 Connection State has changed failed
2020/08/07 11:58:20 Client Close Exit
2020/08/07 11:58:20 Connection State has changed closed
2020/08/07 11:58:20 Client Close Exit

i frame

rtsp flower screen, view have half green, but this stream is OK in vlc. I think it not from i frame decoding leads to some information loss. Is there a way to discard some frames until I get the i frame?

Wowza test rtsp stream not working;

Hello, @deepch !

I tried to use your sample, but wowza test rtsp stream (for example: rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov or rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov) not played.
I have checked via ffplay, vlc and every stream worked. What is the reason for this? Maybe your sample work only with rtsp stream from webcam?

I would appreciate for your reply.
Best regard, Roman.

License for usage?

Hello, is this project available for re-use? If yes, could you please attach an open-source license?
Thank you for the great project.

panic: runtime error: makeslice: len out of range

panic: runtime error: makeslice: len out of range

goroutine 19 [running]:
github.com/deepch/vdk/format/rtsp.(*Client).findRTSP(0xc0004b4000, 0xc000012500, 0x2406, 0x2500, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:443 +0x75a
github.com/deepch/vdk/format/rtsp.(*Client).poll(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:536 +0x7d
github.com/deepch/vdk/format/rtsp.(*Client).readPacket(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1204 +0x84
github.com/deepch/vdk/format/rtsp.(*Client).ReadPacket(0xc0004b4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x140, 0x150)
	/Users/glasssky001/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1228 +0x90
main.serveStreams.func1(0xc00012a886, 0x2, 0xc00016e180, 0x40)
	/Users/glasssky001/GitHub/RTSPtoWebRTC/stream.go:36 +0x484
created by main.serveStreams
	/Users/glasssky001/GitHub/RTSPtoWebRTC/stream.go:12 +0x12c

Force relay mode on WebRTC/ICE transmission

Hi, I'm trying to deploy this project on my server, but I couldn't play it without VPN since WebRTC (or ICE protocol) picks a random port for transmission which my firewall blocked. Is it possible to enforce relay mode on ICE transmission so that I can fix the port for later firewall permission?

Not working in Chrome or Edge

It works in Firefox but not Chrome or Edge ( Windows 10 )

Also.. is there any way to change the layout to show previews or anything? or to stream all as mini streams and click to expand?

I'm wanting to use this for a security camera interface, switching back and forth is very inconvenient for that.. just asking.. but if there's no solution for Chrome I may have to keep looking for something else.. :( which would suck because this is the closest I've gotten to getting something to work properly.

Errors I'm getting:

Uncaught (in promise) DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. a=ssrc:4195826001 msid:Channel 1_pion video Expected format "msid:[ ]".

Uncaught ReferenceError: startSession is not defined at HTMLButtonElement.onclick (Channel 1:39)

It also doesn't work on mobile safari ( iPhone )

rtsp no voice in the browser

Dear Deepch!
I use rtsp to display the video in the browser, but there is no sound, audio coder is PCM ALAW。I don't know how to display audio,Do you have any advice。
vp8Track, err := peerConnection.NewTrack(webrtc.DefaultPayloadTypeH264, rand.Uint32(), "video", "pion2") if err != nil { log.Println(err) return "" } _, err = peerConnection.AddTrack(vp8Track)

startSession is not defined

Uncaught ReferenceError: startSession is not defined
where the function define?i found everwhere,can not find it.

Upgrade to pion v3

Hi,
I ran success with pion v2.
When i upgrade code to pion v3, connection state not connected
It change from "checking" to "failed".
Please help me with this issue, Many thanks

play longtime , runtime error

I play a rtsp stream about 13 hours and then...

anic: runtime error: makeslice: len out of range

goroutine 34 [running]:
github.com/deepch/vdk/format/rtsp.(*Client).findRTSP(0xc0001110e0, 0xc000328000, 0x65d0, 0x6a80, 0x0, 0x0, 0x0, 0x0, 0x0)
C:/Users/stone/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:443 +0x761
github.com/deepch/vdk/format/rtsp.(*Client).poll(0xc0001110e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
C:/Users/stone/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:536 +0x84
github.com/deepch/vdk/format/rtsp.(*Client).readPacket(0xc0001110e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000076000, 0xc000076000)
C:/Users/stone/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1204 +0x8b
github.com/deepch/vdk/format/rtsp.(*Client).ReadPacket(0xc0001110e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b02, 0x1b02)
C:/Users/stone/go/pkg/mod/github.com/deepch/[email protected]/format/rtsp/client.go:1228 +0x97
main.serveStreams.func1(0xc0002148a5, 0x5, 0xc0002c6640, 0x1b)
D:/vscode-ws/RTSPtoWebRTC/RTSPtoWebRTC/stream.go:36 +0x48b
created by main.serveStreams
D:/vscode-ws/RTSPtoWebRTC/RTSPtoWebRTC/stream.go:12 +0x133
exit status 2

T

Not sure how to install/run

go get github.com/deepch/RTSPtoWebRTC

package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of:
	/usr/local/go/src/github.com/go-playground/validator/v10 (from $GOROOT)
	/Users/taf2/work/golibs/src/github.com/go-playground/validator/v10 (from $GOPATH)
package math/bits: unrecognized import path "math/bits" (import path does not begin with hostname)
package github.com/pion/webrtc/v2: cannot find package "github.com/pion/webrtc/v2" in any of:
	/usr/local/go/src/github.com/pion/webrtc/v2 (from $GOROOT)
	/Users/taf2/work/golibs/src/github.com/pion/webrtc/v2 (from $GOPATH)
package github.com/pion/webrtc/v2/pkg/media: cannot find package "github.com/pion/webrtc/v2/pkg/media" in any of:
	/usr/local/go/src/github.com/pion/webrtc/v2/pkg/media (from $GOROOT)
	/Users/taf2/work/golibs/src/github.com/pion/webrtc/v2/pkg/media (from $GOPATH)
go version
go version go1.7.1 darwin/amd64
git clone [email protected]:deepch/RTSPtoWebRTC.git
go run main.go
# command-line-arguments
./main.go:11: undefined: serveHTTP
./main.go:12: undefined: serveStreams

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.