Skip to content

abema/antares

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antares

Go Reference CircleCI Coverage Status Go Report Card

Antares is monitoring system for HLS and MPEG-DASH. This program is written by golang.

Description

Antares monitors any HLS/MPEG-DASH streams and outputs inspection reports. You can use prepared command or Go interfaces.

Command

Install

go install github.com/abema/antares@latest

Example

antares \
	-hls.noEndlist \
	-hls.playlistType omitted \
	-export \
	-export.meta \
	-segment.maxBandwidth 500000 \
	"http://localhost/index.m3u8"

Help

antares -h

Integrate with your Go application

Monitor and Manager

You can use core.Monitor to monitor your live stream as follows:

config := core.NewConfig("http://localhost/index.m3u8", core.StreamTypeHLS)
config.HLS.Inspectors = []core.HLSInspector{
	hls.NewSpeedInspector(),
	hls.NewVariantsSyncInspector(),
}
core.NewMonitor(config)

manager.Manager manages multiple monitors and provides batch update interface.

manager := manager.NewManager(&manager.Config{})
for range time.Tick(time.Minute) {
	configs := make(map[string]*core.Config)
	for _, stream := range listMyCurrentStreams() {
		config := core.NewConfig(stream.URL, stream.StreamType)
		  :
		configs[stream.ID] = config
	}
	added, removed := manager.Batch(configs)
	log.Println("added", added)
	log.Println("removed:", removed)
}

Inspectors

Inspector inspects manifest and segment files. For example, SpeedInspector checks whether addition speed of segment is appropriate as compared to real time. Some inspectors are implemented in inspectors/hls package and inspectors/dash package for each aims. Implementing hls.Inspector or dash.Inspector interface, you can add your any inspectors to Monitor.

Handlers and Adapters

You can set handlers to handle downloaded files, inspection reports, and etc. And adapters package has some useful handlers.

config.OnReport = core.MergeOnReportHandlers(
	adapters.ReportLogger(&adapters.ReportLogConfig{JSON: true}, os.Stdout),
	adapters.Alarm(&adapters.AlarmConfig{
		OnAlarm                      : func(reports core.Reports) { /* start alarm */ },
		OnRecover                    : func(reports core.Reports) { /* stop alarm */ },
		Window                       : 10,
		AlarmIfErrorGreaterThanEqual : 2,
		RecoverIfInfoGreaterThanEqual: 10,
	}),
	func(reports core.Reports) { /* send metrics */ },
)

Manifest format support

HLS

  • Live
  • Event
  • On-demand
  • Byte range
  • LHLS
  • Decryption
  • I-frame-only playlists

DASH

  • Live
  • Static
  • SegmentTimeline
  • Open-Ended SegmentTimeline (S@r = -1)
  • SegmentBase
  • SegmentList
  • Only SegmentTemplate (Without SegmentTimeline/SegmentList)
  • Multi-Period
  • Location
  • Decryption

Identifiers for URL templates:

  • $$
  • $RepresentationID$
  • $Number$
  • $Bandwidth$
  • $Time$
  • $SubNumber$
  • IEEE 1003.1 Format Tag

License

MIT