roverr / rtsp-stream Goto Github PK
View Code? Open in Web Editor NEWOut of box solution for RTSP - HLS live stream transcoding. Makes RTSP easy to play in browsers.
License: MIT License
Out of box solution for RTSP - HLS live stream transcoding. Makes RTSP easy to play in browsers.
License: MIT License
Link with #24 (comment)
(I can't reopen issue. Maybe new issues will be more conspicuous.... )
Hi,Roverr,
Thanks for your last help,and it's effective.
I changed the setting of RTSP_CLEANUP_ENABLED:false , but start api responsebody returns 'running:false' in the course of time. So i want to know what's the meaning of 'running' , and final purpose is knowing the RTSP stream trans state.
Thanks again!
Does Roverr support H265 ?
On rtsp ip camera is configured successfully. When I get the stream by API, it returned the followings. No video is found.
http://x.x.x.x:8080/stream/camera1/index.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:1
#EXT-X-MEDIA-SEQUENCE:546
#EXTINF:0.810667,
546.ts
#EXTINF:0.810667,
547.ts
#EXTINF:0.810667,
548.ts
Dear Sir:
monitor from ubutun network monitor, looks like multiple vlc request to the same url , will raise the network loading to the rtsp source, is this true , or I mess it up ? I suppose they only share the same m3u8 and will not raise the network download .
On the server I run docker run -p 80:80 -p 8080:8080 roverr/rtsp-stream:2-management
.
I get the UI but the add button does nothing. On inspection it seems that it's trying to reach 127.0.0.1
Hi,@Roverr,
I'm coming again , and our project is running perfect in your help !
But i have a new question about disconnecting stream can't auto reconnect , always playing history , so i want to know how to reconnect it without request again !
Thanks again !
BUT video not shown on browser. only error ocurred "ERR_CONNECTION_TIMED_OUT".
Docker log has no error.
And rtsp source is active when I check in VLC player.
What is wrong? Please help me...
Used your project as-is for a couple of hours and ended up with 1 Gb of data lying around. After some extended research, I managed to obtain what I (and I think you) wanted, with the following settings changed in processor.go :
(pasting the patch content did not go well! I have attached it instead!
processor.go.txt
)
Successfully made it run with both your Dockerfile on my local system, although I had to add an EXPOSE statement in both to have the ports 8080 and 80 accessible.
Also, I had to add the following line to Dockerfile.management because of a build error (parsel was missing):
(...)
RUN npm install -g parcel-bundler
(...)
Good job!
Hi,
I've tried to run Docker image on Raspberry Pi 4:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:219: exec user process caused: exec format error
May be it is not so difficult to add support for ARMv8 platform as FFMPEG and Go are cross platform?
Stream work properly for some time and then stops suddenly. And keep reloading for previous 6-8 seconds recorded stream.
clear centos 7 without iptables
POST http://app/start {"uri": "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"}
root@docker-s-1vcpu-1gb-fra1-01:~# docker run -p 80:8080 roverr/rtsp-stream:1
time="2019-08-16T12:23:11Z" level=info msg="RTSP-STREAM started on 8080"
time="2019-08-16T12:23:29Z" level=info msg="wowzaec2demo-streamlock-net-vod-mp4-bigbuckbunny-115k-mov started processing"
time="2019-08-16T12:23:49Z" level=error msg="./videos/wowzaec2demo-streamlock-net-vod-mp4-bigbuckbunny-115k-mov/index.m3u8 timed out while waiting for file creation in manager start"
panic: send on closed channelgoroutine 15 [running]:
github.com/Roverr/rtsp-stream/core.Manager.Start.func3.1()
/go/src/github.com/Roverr/rtsp-stream/core/manager.go:98 +0x106
sync.(*Once).Do(0xc000018ef0, 0xc00002a788)
/usr/local/go/src/sync/once.go:44 +0xb3
github.com/Roverr/rtsp-stream/core.Manager.Start.func3(0x4a817c800, 0xc000018ef0, 0xc000014410, 0x4d, 0xc00004c0e0)
/go/src/github.com/Roverr/rtsp-stream/core/manager.go:96 +0x95
created by github.com/Roverr/rtsp-stream/core.Manager.Start
/go/src/github.com/Roverr/rtsp-stream/core/manager.go:94 +0x12d
root@docker-s-1vcpu-1gb-fra1-01:~#
I found some bugs or improvements.
Restart
after cleanUnused
and restart.ffmeg
create fail (time out).cmd.Stdout
and cmd.Stderr
to get more debug info. Instead of exit status 1
This is detail info:
Should rebuild folderRestart
after cleanUnused
at restart
.
recurrent:
time="2019-11-01T07:58:18Z" level=info msg="./videos/873a0ced-1924-4438-b7ab-1369c3e05b72 has been restarted"
time="2019-11-01T07:58:21Z" level=error msg="exit status 1"
GET /stream/b45dd012-341c-4a7f-ac3e-784eeb88e183/index.m3u8 HTTP/1.1
Host: 10.7.0.117:9094
cache-control: no-cache
404 page not found
position:
createDirectoryForURI(p.storeDir)
in func (p Processor) NewStream
:
rtsp-stream/core/streaming/processor.go
Line 98 in bda6df6
strm.cleanDir()
in func (strm *Stream) CleanProcess()
rtsp-stream/core/streaming/stream.go
Line 32 in bda6df6
But forget rebuild folder:
func (p Processor) Restart(strm *Stream, path string)
rtsp-stream/core/streaming/processor.go
Line 138 in bda6df6
Shouldn't save URL info in list when ffmeg
create fail (time out).
It's an unexist url.
POST /start HTTP/1.1
Host: 10.7.0.117:9094
cache-control: no-cache
{
"uri": "rtsp://10.25.144.106:554/live?camera=14999&user=duansishengtims&pass=E0QjCAJLEHFC"
}
{
"uri": "/stream/de00bf0e-661d-4105-8472-0f93f58ab22c/index.m3u8"
}
After second send http:
time="2019-11-01T08:03:11Z" level=debug msg="Created stream with storepath ./videos/de00bf0e-661d-4105-8472-0f93f58ab22c"
time="2019-11-01T08:03:11Z" level=error msg="Error happened during starting of ./videos/de00bf0e-661d-4105-8472-0f93f58ab22c/index.m3u8 || Error: exit status 1"
time="2019-11-01T08:03:34Z" level=error msg="./videos/de00bf0e-661d-4105-8472-0f93f58ab22c/index.m3u8 timed out while waiting for file creation in manager start"
time="2019-11-01T08:04:37Z" level=info msg="de00bf0e-661d-4105-8472-0f93f58ab22c is active, skipping cleaning process"
Shouldn't save URL info in list when restart or get fail.
If get 404 or something else error, we should delete info in list.
Should redirect cmd.Stdout
and cmd.Stderr
to get more debug info. Instead of exit status 1
like:
https://stackoverflow.com/questions/1877045/how-do-you-get-the-output-of-a-system-command-in-go
But I like this way:
cmd := exec.Command("ls", "-lah")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
}
I tried build this, and get error info in rtsp-stream.err.log
.
Add after here :
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Maybe should save original url in list which http request.
At last, I love this post/get mode. It help me a lot.
Causes unworkable app:
[user@laptop ~]$ docker run -d -e RTSP_STREAM_BLACKLIST_ENABLED=false --name stream -p 80:8080 roverr/rtsp-stream:2
3f8f87d72fc1eaa729e6086aa0a76df0737d5f0da556be3a3351a3017f1cfb12
curl -d '{ "uri": "rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream" }' -X POST http://localhost:80/start
curl: (52) Empty reply from server
[user@laptop ~]$ docker logs stream
time="2020-05-19T20:34:43Z" level=info msg="list endpoint enabled | MainProcess"
time="2020-05-19T20:34:43Z" level=info msg="start endpoint enabled | MainProcess"
time="2020-05-19T20:34:43Z" level=info msg="static endpoint enabled | MainProcess"
time="2020-05-19T20:34:43Z" level=info msg="stop endpoint enabled | MainProcess"
time="2020-05-19T20:34:43Z" level=info msg="rtsp-stream transcoder started on 8080 | MainProcess"
2020/05/19 20:34:50 http: panic serving 172.18.0.1:58230: runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc000174000)
/usr/local/go/src/net/http/server.go:1767 +0x139
panic(0x7fadc0, 0xb9e600)
/usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/Roverr/rtsp-stream/core.(*Controller).StartStreamHandler(0xc0000a47e0, 0x903020, 0xc0001500e0, 0xc00017a000, 0x0, 0x0, 0x0)
/go/src/github.com/Roverr/rtsp-stream/core/controller.go:388 +0x26e
github.com/Roverr/rtsp-stream/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc0000a4780, 0x903020, 0xc0001500e0, 0xc00017a000)
/go/src/github.com/Roverr/rtsp-stream/vendor/github.com/julienschmidt/httprouter/router.go:387 +0xa3d
github.com/Roverr/rtsp-stream/vendor/github.com/rs/cors.(*Cors).Handler.func1(0x903020, 0xc0001500e0, 0xc00017a000)
/go/src/github.com/Roverr/rtsp-stream/vendor/github.com/rs/cors/cors.go:219 +0x1b8
net/http.HandlerFunc.ServeHTTP(0xc00000e0c0, 0x903020, 0xc0001500e0, 0xc00017a000)
/usr/local/go/src/net/http/server.go:2007 +0x44
net/http.serverHandler.ServeHTTP(0xc000150000, 0x903020, 0xc0001500e0, 0xc00017a000)
/usr/local/go/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc000174000, 0x903ca0, 0xc0000141c0)
/usr/local/go/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2928 +0x384
[user@laptop ~]$ curl -d '{ "uri": "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov" }' -X POST http://localhost:80/start
curl: (52) Empty reply from server
What would be the easiest/best way to get an HTTPS embed out of rtsp-stream? I'm running into issues embedding on a secure site.
I have a rstp stream which only runs when we are connected to the vpn. But when I convert that rtsp while I am connected to the vpn to hls stream, the stream only buffers and doesn't plays.
p.s. - The rtsp stream works fine in VLC media player.
It would be appreciated if anyone could help me debug this issue!
I'm trying to integrate stream on my website which is working over https from rtsp-stream docker m38u link which is served over http. And I get mixed content error.
Any chance to solve this issue?
I can't find any other form of contact so my apologies in advance but I found your project and was immediately impressed. The trouble is having tried to restream x2 RTSP IPCCTV sources to HLS format, no matter what I try it has not been possible to send the URL to a ChromeCast.
The RTSP streams can be viewed from VLC(Windows) fine as can the re-streamed HLS but using Home Assistant to try and play the same URL on a local chromecast and the chromecast attempts to play the stream but fails silently.
I've used different media types HLS,application/x-mpegURL,application/vnd.apple.mpegurl
I've tries enabling your CORS environment variables and specifying the wildcard, although the default is to allow all anyway.
I've enabled debugging but this appears to just be for the FFMPEG streaming and this is working fine, which is also confirmed in the logs that are created. I guess I'm going to need wireshark to see what might be happening, if no one has any ideas?
I was hoping this might be something that someone has experience with but if not I will have to continue debugging.
I'm sorry I've not given more detailed explanation but I'm not even sure this will get looked at, so thought it was a good place to start _ Thank you.
My camera for some reason provides an h264 for video and an .aac stream for audio. Any way to get a final web stream that has both audio and video?
Hi,
I'm trying to implement the jwt authorization, but I'm always getting the error message at the token verification (Signature invalid').
How am I supposed to implement the authorization system since there is no doc available?
my technique is to add the appropriate environment variables (RTSP_STREAM_AUTH_JWT_ENABLED=ture | RTPS_STREAM_AUTH_JWT_SECRET="something"), change the config file .yml, and then send the token ="Bearer token" in the request header.
NB;token generated by jsonwebtoken library via hmac algorithm.
thanks.
The transcoded stream file works fine on VLC.
However, it does not play on web players like video.js or hls.js.
Is this normal or is there a special config to make ?
I got the UI running on my Synology DS916+ with Docker.
When posting the link of my rtsp-ip camera I get an "Error: Network Error".
Here's the whole browser error log:
Error: Network Error
at module.exports (createError.js:16)
at XMLHttpRequest.p.onerror (xhr.js:81)
POST http://127.0.0.1:8080/start net::ERR_CONNECTION_REFUSED
What might be the issue?
Thanks
In my case, we have some info in http`s body.
But program forget to deal this.
For example:
We have two address:
rtsp://user:pwd@host/live?camera=146
rtsp://user:pwd@host/live?camera=14
but after decode, all is
"uri": "/stream/host-live/index.m3u8"
It can`t get stream from orgin address.
log is :
time="2019-10-18T06:04:19Z" level=info msg="RTSP-STREAM started on 9094"
time="2019-10-18T06:05:07Z" level=info msg="host-live started processing"
time="2019-10-18T06:05:07Z" level=error msg="Error happened during starting of ./videos/host-live/index.m3u8 || Error: exit status 1"
time="2019-10-18T06:05:32Z" level=error msg="./videos/host-live/index.m3u8 timed out while waiting for file creation in manager start"
tried to use IPv6 address but failed.
Any plan to support it?
I found something wrong with https://github.com/riltech/streamer/blob/master/process.go
if p.audio {
processCommands` = append(processCommands, "-an")
}
-an means disable audio, so by default, the hls video has no audio, if sets RTSP_STREAM_AUDIO_ENABLED=false, -an will not be added to ffmpeg options, the hls audio plays normally.
Hi, do you have any plans to convert RTSP to http-flv or websocket?
This is a slightly off issue, but just wanted to raise it for clarity of documentation.
The start API method takes uri and alias but only seems to use uri for matching stream to start.
Where this became an issue is that I'm doing some development on a kiosk system that views streams from IP cameras and switches between streams. I only have one camera at home, but the site I'm installing at has three, so I have three streams all with the same uri, but different aliases. It's taken me ages to figure out that the alias isn't used when calling start to identify the stream!
There is no sound
Expectation, given a rtsp url, a hls m3u8 url is returned.
docker run -v `pwd`/rtsp-stream.yml:/app/rtsp-stream.yml \
-p 8080:8080 \
-e RTSP_STREAM_DEBUG=true \
roverr/rtsp-stream:latest
version: 1.0
endpoints:
start:
enabled: true
static:
enabled: true
stop:
enabled: true
list:
enabled: true
listen:
- alias: driveway
uri: rtsp://admin:[email protected]:554
enabled: true
(ins)[hendry@t14s cam]$ bash hls.sh
Unable to find image 'roverr/rtsp-stream:latest' locally
latest: Pulling from roverr/rtsp-stream
ff3a5c916c92: Pull complete
260adb6820b2: Pull complete
29be83ba3cf4: Pull complete
51523429c350: Pull complete
Digest: sha256:225792a0c5ad911a5e18156c4e683e7f0c11958d4c65e1ed73d64cdf37cee735
Status: Downloaded newer image for roverr/rtsp-stream:latest
time="2021-06-11T21:15:27Z" level=info msg="RTSP-STREAM started on 8080"
time="2021-06-11T21:22:16Z" level=error msg="unexpected end of JSON input"
Should the uri be rtp like the docs... if so.. why?
Why do I need to POST the rtsp stream URL?
The RTSP URL should be available to set as a docker environment variable rather than a HTTP POST
(https://github.com/Roverr/rtsp-stream/blob/master/docs/api/README.md#post-start) to /start
.
How can this Docker image be fully automated without another container/command to make the POST.
Actually... why can't I set within the config yaml file?! -_-
docker run -d --restart=always --name rtsp-stream -p 81:80 -p 8081:8080 roverr/rtsp-stream:2-management
is 81 and 8081 port also available? or must be 80 and 8081?
in UI http://x.x.x.x:81/,
I enter URL of
rtsp://172.16.55.5:1169/05947160596027700101?DstCode=01&ServiceType=1&ClientType=0&StreamID=1&SrcTP=2&DstTP=2&SrcPP=1&DstPP=1&MediaTransMode=0&BroadcastType=0&SV=0&Token=90WnkTWiVi73twWCx3pjVdvSIjzz8h9+&DomainCode=745a42bef8cf47bfbfa075bf23c86742&UserId=11&
and add, but get no response.
Nowhere in the documentation you tell exactly how to send the JWT for authentication.
Digging the code, it looks like an "Authorization" header is expected in the GET request. Is that correct?
Also, just to clarify, you don't perform any kind of payload validation on the JWT, there is a simple hash validation, right?
I am wondering if this project can only run with docker ?
I was suppose I can run this project as a service providing API,
I can reset the input RTSP URI anytime if I want by call the related API,
then I got the HLS output url to play in browser.
thanks
thanks of this great job!
When given this rtsp stream URL: "rtsp://admin:Lazar613211@@91.196.77.235:554/cam/realmonitor?channel=1&subtype=0
", server is outputting video correctly, but there is no audio.
Hi,
I have a strange situation that if resource stream isn't stable(ex. internet cause lag), the result stream will be played about 2 seconds then starts to freeze.
Then I find out hls protocol has a attribute called "adaptive bitrate" which can be set to control the minimum of a input that the service can process, is there any thing like this in project's environment variables I can use?
Thank you.
To make it a little easier to use this as a docker container it would be nice to be able to specify an environment variable path for the rtsp-stream.yml config file instead of just reading it from the current directory.
This would be appreciated since some docker management tools make it much easier to mount full directories from the host system instead of individual files.
My project always needs transing hls , so i want to know how to do .I can't fand the key of this.
Is there a way to pre-start RTSP streams from the config file where the HTTP end points are consistent? That would really help out for restarting and updating the container, but not having to reset all the clients and reset all the feeds. Maybe there is a way already for that?
This is a slightly off issue, but just wanted to raise it for clarity of documentation.
The start API method takes uri and alias but only seems to use uri for matching stream to start.
Where this became an issue is that I'm doing some development on a kiosk system that views streams from IP cameras and switches between streams. I only have one camera at home, but the site I'm installing at has three, so I have three streams all with the same uri, but different aliases. It's taken me ages to figure out that the alias isn't used when calling start to identify the stream!
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.