deepch / rtsptoweb Goto Github PK
View Code? Open in Web Editor NEWRTSP Stream to WebBrowser
License: MIT License
RTSP Stream to WebBrowser
License: MIT License
I have an encoder with the following rtsp codec:
Unfortunately, MSE, HLS or WebRTC do not work. I get the following error in the debug log:
2021/03/16 15:54:49 [OPTIONS rtsp://192.168.30.121:4444/vustream150/ RTSP/1.0
CSeq: 7
Require: implicit-play
User-Agent: Lavf58.20.100
Session: 56769DA6
]
2021/03/16 15:54:49 [Unsuported Intervaled data packet 1 [244 203 175 150 245 138 184 59 0 0 186 142 3 156 195 0 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:54:49 [Unsuported Intervaled data packet 1 [244 203 175 150 245 138 184 59 0 0 186 142 3 156 195 0 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:54:55 [Unsuported Intervaled data packet 1 [211 139 172 113 245 146 199 242 0 0 195 48 3 198 176 160 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:54:55 [Unsuported Intervaled data packet 1 [211 139 172 113 245 146 199 242 0 0 195 48 3 198 176 160 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:54:59 [Unsuported Intervaled data packet 1 [181 41 237 57 245 152 28 120 0 0 201 97 3 228 198 192 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:54:59 [Unsuported Intervaled data packet 1 [181 41 237 57 245 152 28 120 0 0 201 97 3 228 198 192 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:55:04 [Unsuported Intervaled data packet 1 [214 221 172 239 245 159 40 145 0 0 210 173 4 18 91 60 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:55:04 [Unsuported Intervaled data packet 1 [214 221 172 239 245 159 40 145 0 0 210 173 4 18 91 60 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:55:09 [OPTIONS rtsp://192.168.30.202:554/ RTSP/1.0
CSeq: 2684
Require: implicit-play
User-Agent: Lavf58.20.100
Authorization: Basic YWRtaW46VnV3YWxsMDkh
Session: 1977078712
]
2021/03/16 15:55:10 [Unsuported Intervaled data packet 1 [171 55 201 155 245 167 42 0 0 0 220 37 4 64 128 100 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:55:10 [Unsuported Intervaled data packet 1 [171 55 201 155 245 167 42 0 0 0 220 37 4 64 128 100 129 202 0 4 173 201 208 253 1 9 84 65 67 45 84 82 65 78 83 0]]
2021/03/16 15:55:15 [OPTIONS rtsp://192.168.30.121:4444/vustream150/ RTSP/1.0
CSeq: 8
Require: implicit-play
User-Agent: Lavf58.20.100
Session: 62A6E1E2
]
if delete all stream through de api the map become nil and no longer be able to add any stream. here is the panic:
2020/11/16 13:17:20 http: panic serving 127.0.0.1:57108: assignment to entry in nil map
goroutine 27 [running]:
net/http.(*conn).serve.func1(0xc00025c8c0)
/usr/lib/golang/src/net/http/server.go:1800 +0x139
panic(0xb6d5a0, 0xd59b60)
/usr/lib/golang/src/runtime/panic.go:975 +0x3e3
main.(*StorageST).StreamAdd(0xc000381110, 0xc0004aa6cd, 0x8, 0xc0004ee600, 0x11, 0xc0004d1f50, 0x0, 0x0)
/home/nmityok/workspace/rtsptoweb/storageStream.go:32 +0x3ca
main.HTTPAPIServerStreamAdd(0xc0004fc000)
/home/nmityok/workspace/rtsptoweb/apiHTTPStream.go:28 +0x5e3
github.com/gin-gonic/gin.(*Context).Next(0xc0004fc000)
/home/nmityok/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 +0x3b
main.CrossOrigin.func1(0xc0004fc000)
/home/nmityok/workspace/rtsptoweb/apiHTTPRouter.go:246 +0x39b
github.com/gin-gonic/gin.(*Context).Next(0xc0004fc000)
/home/nmityok/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 +0x3b
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0002ae000, 0xc0004fc000)
/home/nmityok/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409 +0x666
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0002ae000, 0xd75760, 0xc0004f20e0, 0xc00013d900)
/home/nmityok/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367 +0x14d
net/http.serverHandler.ServeHTTP(0xc0004f2000, 0xd75760, 0xc0004f20e0, 0xc00013d900)
/usr/lib/golang/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc00025c8c0, 0xd77760, 0xc0004a9380)
/usr/lib/golang/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
/usr/lib/golang/src/net/http/server.go:2962 +0x35c
through webrtc ,ip camera video is treaming but after few seconds vdio stoped suddenly and consloe shows " 0:294 Uncaught DOMException: Failed to execute 'send' on 'RTCDataChannel': RTCDataChannel.readyState is not 'open' "how can i fix this
The video window is open for a long time, the video time will be slow.
I want frame skipping to be handled.
How should I do it?
it'd be add a multiview (ie multiple camera simultaneously) web demo ui to test parallel view.
Have any way to record stream?
our exported cameras second stream (ie low resolution) gives these errors on servers console:
2020/09/10 23:38:04 Stream office-1-high success connection RTSP
2020/09/10 23:38:04 Stream office-1-low success connection RTSP
2020/09/10 23:38:04 Stream office-2-high success connection RTSP
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
2020/09/10 23:38:04 [Fix Stream IDX]
the strange thing is that live is working at tha same time. it wasn't happened before.
Hi,
i tried different app and get the stream working on VLC but can't under any of your repo :/
in RTSPtoWeb i got that:
INFO[2021-07-21T06:15:04-09:00] Success connection RTSP call=Start channel=aquarium func=StreamServerRunStream module=core stream=demo
ERRO[2021-07-21T06:15:06-09:00] Stream error restart stream stream stop rtsp signal call=Restart
So it succeed to connect first and directly after restart :/
my camera is a Vstarcam C29S
У нас есть несколько потоков, которые отдаются с mjpeg внутри rtsp. Не то чтобы это сильно критично, но возможность отображать и эти потоки, не помешала бы.
when in a browser tab a live view in put into the background and switch back then the live continues from where it's stopped instead of the current time.
we add 7 stream and then remove one through the API and got this error:
rtspToWeb.log
while the network are working the server logs this into the console. the strange thing is that ALL camera comes from the same server but the server has 4 ip alias on it's external ethernet interface. but the log only show that it can't connect to one camera. so there probably can't be any network issue otherwise all camera should have to stop working
INFO[2020-10-13T11:34:18+02:00] Success connection RTSP call=Start channel=1 func=StreamServerRunStream module=core stream=office-3
ERRO[2020-10-13T17:43:48+02:00] stream no video call=ErrorStreamNoVideo channel=1 func=HTTPAPIServerStreamMSE module=http_mse stream=office-1
ERRO[2020-10-13T17:43:48+02:00] read tcp 192.168.209.200:8083->192.168.209.200:45292: use of closed network connection call=Receive channel=1 func=HTTPAPIServerStreamMSE module=http_mse stream=office-1
ERRO[2020-10-13T17:43:48+02:00] <nil> call=Close channel=1 func=HTTPAPIServerStreamMSE module=http_mse stream=office-1
ERRO[2020-10-13T17:43:48+02:00] write tcp 192.168.209.200:8083->192.168.209.200:45292: use of closed network connection call=Close channel=1 func=HTTPAPIServerStreamMSE module=http_mse stream=office-1
ERRO[2020-10-13T17:44:00+02:00] Stream error restart stream stream no video call=Restart channel=1 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:00+02:00] Stream error restart stream stream no video call=Restart channel=0 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:02+02:00] Run stream call=Run channel=1 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:02+02:00] Run stream call=Run channel=0 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:05+02:00] Stream error restart stream dial tcp 192.168.218.141:554: i/o timeout call=Restart channel=1 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:05+02:00] Stream error restart stream dial tcp 192.168.218.141:554: i/o timeout call=Restart channel=0 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:07+02:00] Run stream call=Run channel=1 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:07+02:00] Run stream call=Run channel=0 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:09+02:00] Stream error restart stream dial tcp 192.168.218.141:554: connect: no route to host call=Restart channel=1 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:10+02:00] Stream error restart stream dial tcp 192.168.218.141:554: i/o timeout call=Restart channel=0 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:11+02:00] Run stream call=Run channel=1 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:11+02:00] Stop stream no client call=ClientHas channel=1 func=StreamServerRunStreamDo module=core stream=office-1
INFO[2020-10-13T17:44:12+02:00] Run stream call=Run channel=0 func=StreamServerRunStreamDo module=core stream=office-1
ERRO[2020-10-13T17:44:15+02:00] Stream error restart stream dial tcp 192.168.218.141:554: connect: no route to host call=Restart channel=0 func=StreamServerRunStreamDo module=core stream=office-1
I have some streams that start and stop after 15 seconds , if i reload and restart , play only 15 seconds again.
this is the diff after a make:
diff --git a/go.sum b/go.sum
index 305d22b..85bbae3 100644
--- a/go.sum
+++ b/go.sum
@@ -42,6 +42,7 @@ github.com/hashicorp/go-version v0.0.0-20161031182605-e96d38404026/go.mod h1:flt
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -54,7 +55,9 @@ github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9/go.mod h1
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
write: connection reset by peer
it'd be useful if i can add and delete multiple streams ones.
In my tests I found that MSE works very well. Unfortunately, I can't say the same for WebRTC and HLS, the streams stop every few seconds. Are there any tweaks that can be applied here? For example, higher buffer etc.?
С помощью https://github.com/aler9/rtsp-simple-server и ffmpeg сгенерировал поток rtsp из набора картинок вот такой командой:
ffmpeg -re -stream_loop -1 -framerate 12 -i %04d.jpg -profile:v baseline -level:v 4.0 -c:v libx264 -r 12 -pix_fmt yuv420p -f rtsp -rtsp_transport tcp rtsp://localhost:8554/images
картинки - 720х576.
полученный поток чудесно отображается в vlc, нормально преобразуется в rtmp и hls тем же ffmpeg и выводится в web-плеер. Однако в RTSPtoWeb почему-то не хочет, запускается, проигрывается некоторое время и останавливается. Не могу понять в чем дело.
currently the web/ directory should have to in under the same dir as the binary. suppose i put the binary into /usr/bin/ then it should have to be in /usr/bin/web/ and it's not even configurable! it should have to be configurable and IMHO the best default would be in the same directory as the config file. ie in case of a start like this:
/usr/bin/rtsp-to-web --config /etc/rtsp-to-web/config.json
it should have to search for /etc/rtsp-to-web/web/ and the path could be configurable in the config file.
or at least document where should i have to put that directory...
This looks like great project, will audio codecs in rtsp ever be supported?
would you fix the go.mod file to contain th after build version ie:
diff --git a/go.mod b/go.mod
index bff59e0..b6e8c2b 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.15
require (
github.com/deepch/vdk v0.0.0-20210508200759-5adbbcc01f89
- github.com/gin-gonic/autotls v0.0.3 // indirect
+ github.com/gin-gonic/autotls v0.0.3
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.4.3 // indirect
thx for your good job~
Line 58 in 2be23e9
count clients why not like this:
if len(channelTmp.clients) > 0 { return true }
this mean all client will auto-offline after 30s?
It would be possible to add a rtmp source?
Hi,
I've done RTSPtoWeb with goland 1.16, on a raspberry under Pi Os Buster 32bits, uptodate. I've connected 2 cameras with rtsp, codec H.264, 2 weeks ago.
All is working on my laptop ( windows 10 ) and on my androïd phone ( multiview, each viewing mode : HLS, MSE, RTC )
But nothing at all on my iPad and on an iPhone ( iOs or iPadOS 14.4, with SAFARI ). For rtc and mse i think it's normal, ios doesn't support them, but for hls there is normally a native support.
I've read there is security mechanism inside ios so I haven't tested further.
But sunday I've seen the new version with https support. So I've done some tests with it. But same problem : impossible to play HLS. The videoplayer stay unavailable. I've tried in http and in https
In the logs of RTSPtoWeb : i see the call of the m3u8 playlist file which is ok, but no call of the files.ts for a segment. So i think that iOS doen't make the call for any reason, but I have no debug tools on iPhone or iPad ( apparently an iMac is requiered ) to have more informations.
Has someone the same trouble ? Any idea how to solve that ?
Note : I've converted few minutes of my camera rtsp stream with vlc to hls : the m3u8 playlist is well display under SAFARI ( in a simple html page under apache ) when the m3u8 file and ts files are stored on my raspberry.
Would you consider making this project open source with an MIT license?
it'd be useful to use this server as an rtps proxy. ie for each stream we can define an rtsp output too. in this case if this server runs on a server with multiple network interface than it can be act like an rtsp proxy. the the output rtsp url can be generated from the config itself automatically without any kind of config parameter.
eg using the config file described in #3
source url: rtsp://admin:[email protected]/Streaming/Channels/1
the server's ip address is 1.2.3.4, the channel id is i01
and the stream id main
than the server can proxy this
rtsp at: rtsp://1.2.3.4/rtsp/i01/main
Hello! When trying play video from an iPhone (iOS 12.1.4), this error occurs:
ERRO[2021-04-02T16:20:03Z] TypeError: offer SDP semantics does not match configuration call=WriteHeader channel=0 func=HTTPAPIServerStreamWebRTC module=http_webrtc stream=cam1
Dear sir,
can you make a new software for recording the rstp resource. thank you
project is run ,but webrtc not play,
error :test-golang-rtsptoweb | time="2021-06-04T05:49:56Z" level=error msg="WebRTC Client Offline" call=WritePacket channel=0 func=HTTPAPIServerStreamWebRTC module=http_webrtc stream=demo
Hi, tried to set stream to unifi camrea from rtsp stream and i get this error:
24 Type need add next version report https://github.com/deepch/vdk
Hi there,
I am getting a green corrupted image on some of my cameras like such:
With debug logs enabled, I am seeing many "Unsupported Intervaled data packet". Not sure if it's related? See logs: https://pastebin.com/yr4dnU2M -- restarting the camera brings back the image, but it eventually becomes green again. Not sure when/why it does become green.
VLC always shows the stream perfectly. The same stream also works fine with your RTSPtoWSMP4f project.
ie user/password and hostname.
I want to set udp range (ex: 30000-50000)
but I cannot find where it is ...
can I change udp range ?
it'd be useful if there will be one more level over the streams in config files. it can be called eg channels. in this case all channels (eg i cameras) can have more streams (as all cameras). may be an addition name can be useful for not just each each streams but for cameras.
an example json can be like this:
{
"server":{
"debug":true,
"http_demo":true,
"http_debug":false,
"http_login":"demo",
"http_password":"demo",
"http_port":":8083"
},
"channels":[
{
"id":"i01",
"name":"front door",
"on_demand":false,
"debug":true,
"streams":[
{
"id":"main",
"name":"high res",
"source":"rtsp://admin:[email protected]/Streaming/Channels/1",
"proxy":"/i01/high"
},
{
"id":"sub",
"name":"low res",
"source":"rtsp://admin:[email protected]/Streaming/Channels/2",
"proxy":"/i01/low"
}
]
},
{
"id":"i02",
"name":"back door",
"on_demand":false,
"debug":true,
"streams":[
{
"id":"main",
"name":"high res",
"source":"rtsp://admin:[email protected]/Streaming/Channels/1",
"proxy":"/i02/high"
},
{
"id":"sub",
"name":"low res",
"source":"rtsp://admin:[email protected]/Streaming/Channels/2",
"proxy":"/i02/low"
}
]
}
]
}



In debug I see that /auth is missing, so login is not possible.
--request POST \
--data '["0678af02-701f-48f8-8fb8-2c0c3e0a1a02", "2a787219-dda4-41ff-aded-e123cb5fc4ea", "577f167d-d560-45d5-b71f-26f6e48228b5", "57f4a2d2-bac4-4bff-b6c8-f5eef58c95d5", "af089982-0a81-4084-ad89-3c0ea6c32c46", "cc5a44ed-c5b3-4485-b0b0-38aeea78a291"]' http://demo:[email protected]:80/streams/multi/control/delete
it should have to fix.
anyway sometimes it's working when i change http_debug to true and loglevel to info. it seems to me some kind of timing issue. and we can reproduce it now (even though it was very difficult to find the problem)
Доброго времени суток.
Спасибо за проект! Потребовалось вывести видео-поток с парочки камер, просто для демонстрации что всё бегает. Но для красоты решили использовать домен третьего уровня my.hostname.com
, вместо hostname.com:8083
. Ну и столкнулся с небольшой проблемой.
» Что у нас есть - debian 9
и apache2
.
Конфигурационный файл config.json
- дефолтный, единственное что указал свои IP адреса камер.
Создал вот такую конфигурацию (на период тестирования включал доступ через веб-авторизацию, ибо пока не разобрался как, отключив режим демо, производить авторизацию по пользователю из конфига).
cat /etc/apache2/sites-enabled/my.hostname.com.conf
<VirtualHost *:80>
# <Proxy *>
# Order deny,allow
# Allow from all
# AuthType Basic
# AuthName "Password Required"
# AuthUserFile .myhtpasswd
# Require valid-user
# </Proxy>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8083/
ProxyPassReverse / http://127.0.0.1:8083/
ServerName my.hostname.com
ServerAlias www.my.hostname.com
CustomLog ${APACHE_LOG_DIR}/my.hostname.com.access_log combined
ErrorLog ${APACHE_LOG_DIR}/my.hostname.com.error_log
</VirtualHost>
Так же создал сервисный файл для запуска в демоне, чтоб в консоли не висело.
cat /lib/systemd/system/rtsptoweb.service
[Unit]
Description=RTSPtoWeb
After=syslog.target
After=network.target
[Service]
WorkingDirectory=/opt/RTSPtoWeb/
ExecStart=/opt/RTSPtoWeb/RTSPtoWeb
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rtsptoweb
Restart=always
User=nobody
Group=nogroup
[Install]
WantedBy=multi-user.target
Прописал отдельно складывать логи в файл, предварительно создав папку /opt/RTSPtoWeb/log/
. Судя по файлам этот функционал пока еще в ToDo. В общем ротацию логов я тоже решил отложить. Пока приоритет "запустить-показать" да и с 4х камер в режиме h.264/720p/15FPS за 30 минут лог-файл стал весить 200КБ (и то из-за обрывов на линии).
cat /etc/rsyslog.d/rtsptoweb.conf
if $programname == 'rtsptoweb' then /opt/RTSPtoWeb/log/rtsptoweb.log
& stop
» Проблема
В целом почти все устраивает, за исключением мультирежима.
http://hostname.com:8083/pages/multiview/full
(без домена 3 уровня и по порту) - то полный порядокhttp://my.hostname.com/pages/multiview/full
- то увы с камер нет потока.WebSocket connection to 'ws://my.hostname.com/stream/cam1/channel/0/mse?uuid=cam1&channel=0' failed: (anonymous) @ full:560
WebSocket connection to 'ws://my.hostname.com/stream/cam2/channel/0/mse?uuid=cam2&channel=0' failed: (anonymous) @ full:560
.......
Есть какие-нибудь идеи как это победить?
when we call the api stream edit we've got this trace:
panic: assignment to entry in nil map
goroutine 35 [running]:
main.(*StorageST).StreamHLSAdd(0xc00008e1e0, 0xc000098a6c, 0x4, 0xc00018c780, 0xb, 0x10, 0x68d835c0)
/home/cskreth/RTSPtoWeb/storageStreamHLS.go:17 +0x170
main.StreamServerRunStream(0xc000098a6c, 0x4, 0xc0002f6100, 0xc0002f6100, 0x0, 0x0)
/home/cskreth/RTSPtoWeb/streamCore.go:91 +0x81d
main.StreamServerRunStreamDo(0xc000098a6c, 0x4)
/home/cskreth/RTSPtoWeb/streamCore.go:19 +0x1d4
created by main.(*StorageST).StreamRunAll
/home/cskreth/RTSPtoWeb/storageStream.go:28 +0x166
In case anyone needs this, here's a change that keeps a few old HLS segments in storage. We had a media server trying to fetch old segments.
--- storageStreamHLS.go
+++ storageStreamHLS.go
@@ -16,8 +17,8 @@ func (obj *StorageST) StreamHLSAdd(uuid string, channelID string, val []*av.Pack
if channelTmp, ok := tmp.Channels[channelID]; ok {
channelTmp.hlsSegmentNumber++
channelTmp.hlsSegmentBuffer[channelTmp.hlsSegmentNumber] = SegmentOld{data: val, dur: dur}
- if len(channelTmp.hlsSegmentBuffer) >= 6 {
- delete(channelTmp.hlsSegmentBuffer, channelTmp.hlsSegmentNumber-6-1)
+ if len(channelTmp.hlsSegmentBuffer) >= 10 {
+ delete(channelTmp.hlsSegmentBuffer, channelTmp.hlsSegmentNumber-10-1)
}
tmp.Channels[channelID] = channelTmp
obj.Streams[uuid] = tmp
@@ -33,16 +34,21 @@ func (obj *StorageST) StreamHLSm3u8(uuid string, channelID string) (string, int,
if channelTmp, ok := tmp.Channels[channelID]; ok {
var out string
//TODO fix it
- out += "#EXTM3U\r\n#EXT-X-TARGETDURATION:4\r\n#EXT-X-VERSION:4\r\n#EXT-X-MEDIA-SEQUENCE:" + strconv.Itoa(channelTmp.hlsSegmentNumber) + "\r\n"
+ out += "#EXTM3U\r\n#EXT-X-TARGETDURATION:2\r\n#EXT-X-VERSION:4\r\n#EXT-X-MEDIA-SEQUENCE:" + strconv.Itoa(channelTmp.hlsSegmentNumber - 6) + "\r\n"
var keys []int
for k := range channelTmp.hlsSegmentBuffer {
keys = append(keys, k)
}
sort.Ints(keys)
- var count int
- for _, i := range keys {
- count++
- out += "#EXTINF:" + strconv.FormatFloat(channelTmp.hlsSegmentBuffer[i].dur.Seconds(), 'f', 1, 64) + ",\r\nsegment/" + strconv.Itoa(i) + "/file.ts\r\n"
+ count := len(keys)
+ min := 0
+ if len(keys) > 7 {
+ min = len(keys) - 7
+ }
+ max := len(keys) - 1
+ for i := min; i <= max; i++ {
+ segmentNumber := keys[i]
+ out += "#EXTINF:" + strconv.FormatFloat(channelTmp.hlsSegmentBuffer[segmentNumber].dur.Seconds(), 'f', 1, 64) + ",\r\nsegment/" + strconv.Itoa(segmentNumber) + "/file.ts\r\n"
}
return out, count, nil
Hi,
First of all I want to thank you guys for this very useful project.
I have two questions about the project
I'm new to video streaming protocols, sorry if the questions are nonsense.
Thanks in advance
I tried out this and find it very interesting, but I am not an experienced and I am confused about how to run it, when i eun the $ GO111MODULE=on go run *.go
, It works nicely but if I were to close the console, the feed does not run.
Another question I have is, in the mutiview mode, how xan I display all the camera feeds without having to manually add them?
the current docs is not in sync or not working with the current server
I am attempting a binary install as described in the README.md, but I cannot find anything in the releases directory. Is a binary install still an option? If so, please give a github noob some guidance :)
Thanks,
Bill
When I make it:
GO111MODULE=on go run *.go
The shell returns:
hlsFragment.go:6:2: cannot find package "github.com/deepch/vdk/av" in any of:
/usr/lib/go-1.10/src/github.com/deepch/vdk/av (from $GOROOT)
/home/eurek/go/src/github.com/deepch/vdk/av (from $GOPATH)
apiHTTPHLSLL.go:4:2: cannot find package "github.com/deepch/vdk/format/mp4f" in any of:
/usr/lib/go-1.10/src/github.com/deepch/vdk/format/mp4f (from $GOROOT)
/home/eurek/go/src/github.com/deepch/vdk/format/mp4f (from $GOPATH)
streamCore.go:8:2: cannot find package "github.com/deepch/vdk/format/rtspv2" in any of:
/usr/lib/go-1.10/src/github.com/deepch/vdk/format/rtspv2 (from $GOROOT)
/home/eurek/go/src/github.com/deepch/vdk/format/rtspv2 (from $GOPATH)
apiHTTPHLS.go:7:2: cannot find package "github.com/deepch/vdk/format/ts" in any of:
/usr/lib/go-1.10/src/github.com/deepch/vdk/format/ts (from $GOROOT)
/home/eurek/go/src/github.com/deepch/vdk/format/ts (from $GOPATH)
apiHTTPWebRTC.go:6:2: cannot find package "github.com/deepch/vdk/format/webrtcv3" in any of:
/usr/lib/go-1.10/src/github.com/deepch/vdk/format/webrtcv3 (from $GOROOT)
/home/eurek/go/src/github.com/deepch/vdk/format/webrtcv3 (from $GOPATH)
apiHTTPRouter.go:8:2: cannot find package "github.com/gin-gonic/autotls" in any of:
/usr/lib/go-1.10/src/github.com/gin-gonic/autotls (from $GOROOT)
/home/eurek/go/src/github.com/gin-gonic/autotls (from $GOPATH)
apiHTTPChannel.go:4:2: cannot find package "github.com/gin-gonic/gin" in any of:
/usr/lib/go-1.10/src/github.com/gin-gonic/gin (from $GOROOT)
/home/eurek/go/src/github.com/gin-gonic/gin (from $GOPATH)
storageConfig.go:10:2: cannot find package "github.com/hashicorp/go-version" in any of:
/usr/lib/go-1.10/src/github.com/hashicorp/go-version (from $GOROOT)
/home/eurek/go/src/github.com/hashicorp/go-version (from $GOPATH)
storageConfig.go:12:2: cannot find package "github.com/liip/sheriff" in any of:
/usr/lib/go-1.10/src/github.com/liip/sheriff (from $GOROOT)
/home/eurek/go/src/github.com/liip/sheriff (from $GOPATH)
apiHTTPChannel.go:5:2: cannot find package "github.com/sirupsen/logrus" in any of:
/usr/lib/go-1.10/src/github.com/sirupsen/logrus (from $GOROOT)
/home/eurek/go/src/github.com/sirupsen/logrus (from $GOPATH)
apiHTTPMSE.go:8:2: cannot find package "golang.org/x/net/websocket" in any of:
/usr/lib/go-1.10/src/golang.org/x/net/websocket (from $GOROOT)
/home/eurek/go/src/golang.org/x/net/websocket (from $GOPATH)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.