mpdgrabber

package module
v0.0.0-...-5214aa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 23 Imported by: 1

README

mpdGrabber

Experimental, unsupported library + tool to backup mpeg-dash streams.

Think of a dash/mpd only, light version of youtube-dl or ffmpeg stream downloader but 10x faster.

  • Audio, video and subtitles (webvtt and ttml) streams are supported (fragmented or not).
  • Subtitle streams are also converted to files in case your player doesn't play the embedded version.
  • Live streams not supported

Why is it so fast you might ask? Because the streams are downloaded concurrently and reasseembled at the end. When other tools usually download one 1 segment at a time.

What about m3u8/hsls streams?

Take a look at m3u8Grabber

How can I backup

That's not the purpose of this library, write your own wrapper that gets the .mpd and feed it to this library.

Why do I need to have ffmpeg installed?

Because the final stream is currently being assembled using ffmpeg but I might end up doing the muxing in Go myself to drop the dependency later on.

Documentation

Index

Constants

View Source
const UnknownString = "unknown"

Variables

View Source
var (
	TotalWorkers = 6
	TmpFolder, _ = ioutil.TempDir("", "mpdgrabber")

	AudioDownloadEnabled = true
	VideoDownloadEnabled = true
	TextDownloadEnabled  = true
	// inclusive filter, all languages are downloaded by default
	LangFilter = []string{}

	DlChan = make(chan *WJob)
)
View Source
var Debug = false

Functions

func Close

func Close()

Close closes the open channels to stop the workers cleanly

func DownloadFromMPDFile

func DownloadFromMPDFile(manifestURL, pathToUse, outFilename string) error

func FfmpegPath

func FfmpegPath() (string, error)

func LaunchWorkers

func LaunchWorkers(wg *sync.WaitGroup, stop <-chan bool)

LaunchWorkers starts download workers

func Mux

func Mux(outFilePath string, audioTracks, videoTracks, textTracks []*OutputTrack) error

Types

type BytesWriter

type BytesWriter struct {
	Size int
	Buf  []byte
}

func NewByteWriter

func NewByteWriter(size int) *BytesWriter

func (*BytesWriter) Write

func (bw *BytesWriter) Write(p []byte) (n int, err error)

type ContentType

type ContentType int
const (
	ContentTypeAudio ContentType = iota
	ContentTypeVideo
	ContentTypeText
)

func (ContentType) String

func (c ContentType) String() string

type OutputTrack

type OutputTrack struct {
	RepresentationID string
	BaseURL          string // optional
	Language         string
	Codec            string
	SampleRate       int
	AbsolutePath     string
	MediaType        ContentType
}

type WJob

type WJob struct {
	Type          WJobType
	SkipConverter bool
	SubsOnly      bool
	AudioOnly     bool
	URL           string
	AbsolutePath  string
	DestPath      string
	Filename      string
	Pos           int
	Total         int
	Lang          string
	// Err gets populated if something goes wrong while processing the job
	Err error
	// contains filtered or unexported fields
}

type WJobType

type WJobType int
const (
	ManifestDL WJobType
	VideoSegmentDL
	VideoPartialSegmentDL
	AudioSegmentDL
	AudioPartialSegmentDL
	TextSegmentDL
	TextPartialSegmentDL
	TextDL
)

func (WJobType) String

func (w WJobType) String() string

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func (*Worker) Work

func (w *Worker) Work()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL