https://github.com/riltech/streamer
Go Package built around spinning up streaming processes
https://github.com/riltech/streamer
go golang golang-library golang-package hls rtsp rtsp-client stream streaming
Last synced: 12 months ago
JSON representation
Go Package built around spinning up streaming processes
- Host: GitHub
- URL: https://github.com/riltech/streamer
- Owner: riltech
- License: mit
- Created: 2020-02-06T18:53:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-24T14:26:31.000Z (almost 2 years ago)
- Last Synced: 2024-11-25T17:46:03.534Z (over 1 year ago)
- Topics: go, golang, golang-library, golang-package, hls, rtsp, rtsp-client, stream, streaming
- Language: Go
- Size: 9.77 KB
- Stars: 40
- Watchers: 4
- Forks: 33
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# streamer
[](https://goreportcard.com/report/github.com/riltech/streamer)
[](https://opensource.org/licenses/MIT)


Go Package built around spinning up streaming processes
# How
Stream exposes a struct called `Stream` which starts an underlying ffmpeg process to
transcode incoming raw RTSP stream to HLS based on parameters.
It provides a handy interface to handle streams
[More info on docs](https://godoc.org/github.com/riltech/streamer)
# Example usage
```go
import "github.com/riltech/streamer"
func main() {
stream, id := streamer.NewStream(
"rtsp://admin:password@host.dyndns.org:447/Streaming/Channel/2", // URI of raw RTSP stream
"./videos", // Directory where to store video chunks and indexes. Should exist already
true, // Indicates if stream should be keeping files after it is stopped or clean the directory
true, // Indicates if Audio should be enabled or not
streamer.ProcessLoggingOpts{
Enabled: true, // Indicates if process logging is enabled
Compress: true, // Indicates if logs should be compressed
Directory: "/tmp/logs/stream", // Directory to store logs
MaxAge: 0, // Max age for a log. 0 is infinite
MaxBackups: 2, // Maximum backups to keep
MaxSize: 500, // Maximum size of a log in megabytes
},
25*time.Second, // Time to wait before declaring a stream start failed
)
// Returns a waitGroup where the stream checking the underlying process for a successful start
stream.Start().Wait()
}
```