Skip to content

Go Package built around spinning up streaming processes

License

Notifications You must be signed in to change notification settings

mark1ns0n/streamer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamer

Go Report Card License: MIT GitHub last commit GitHub release

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

Example usage

import "github.com/riltech/streamer"

func main() {
	stream, id := streamer.NewStream(
		"rtsp://admin:[email protected]: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() 
}

Updates

Added

-hls_flags +program_date_time

to have tag

EXT-X-PROGRAM-DATE-TIME

in m3u8 playlist to have possibility to see absolute time of stream fragment.

About

Go Package built around spinning up streaming processes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%