transcoder

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 2 Imported by: 0

README

Golang Transcoding Library



Created by FlooStack.

Features

Ease use
Implement your own business logic around easy interfaces
Transcoding progress
Obtain progress events generated by transcoding application process

Download from Github

go get github.com/floostack/transcoder

Example

package main

import (
	"log"

	ffmpeg "github.com/floostack/transcoder/ffmpeg"
)

func main() {

	format := "mp4"
	overwrite := true

	opts := ffmpeg.Options{
		OutputFormat: &format,
		Overwrite:    &overwrite,
	}

	ffmpegConf := &ffmpeg.Config{
		FfmpegBinPath:   "/usr/local/bin/ffmpeg",
		FfprobeBinPath:  "/usr/local/bin/ffprobe",
		ProgressEnabled: true,
	}

	progress, err := ffmpeg.
		New(ffmpegConf).
		Input("/tmp/avi").
		Output("/tmp/mp4").
		WithOptions(opts).
		Start(opts)

	if err != nil {
		log.Fatal(err)
	}

	for msg := range progress {
		log.Printf("%+v", msg)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface{}

Config ...

type Disposition

type Disposition interface {
	GetDefault() int
	GetDub() int
	GetOriginal() int
	GetComment() int
	GetLyrics() int
	GetKaraoke() int
	GetForced() int
	GetHearingImpaired() int
	GetVisualImpaired() int
	GetCleanEffects() int
}

Disposition ...

type Format

type Format interface {
	GetFilename() string
	GetNbStreams() int
	GetNbPrograms() int
	GetFormatName() string
	GetFormatLongName() string
	GetDuration() string
	GetSize() string
	GetBitRate() string
	GetProbeScore() int
	GetTags() Tags
}

Format ...

type Metadata

type Metadata interface {
	GetFormat() Format
	GetStreams() []Streams
}

Metadata ...

type Options

type Options interface {
	GetStrArguments() []string
}

Options ...

type Progress

type Progress interface {
	GetFramesProcessed() string
	GetCurrentTime() string
	GetCurrentBitrate() string
	GetProgress() float64
	GetSpeed() string
}

Progress ...

type Streams

type Streams interface {
	GetIndex() int
	GetID() string
	GetCodecName() string
	GetCodecLongName() string
	GetProfile() string
	GetCodecType() string
	GetCodecTimeBase() string
	GetCodecTagString() string
	GetCodecTag() string
	GetWidth() int
	GetHeight() int
	GetCodedWidth() int
	GetCodedHeight() int
	GetHasBFrames() int
	GetSampleAspectRatio() string
	GetDisplayAspectRatio() string
	GetPixFmt() string
	GetLevel() int
	GetChromaLocation() string
	GetRefs() int
	GetQuarterSample() string
	GetDivxPacked() string
	GetRFrameRrate() string
	GetAvgFrameRate() string
	GetTimeBase() string
	GetDurationTs() int
	GetDuration() string
	GetDisposition() Disposition
	GetBitRate() string
}

Streams ...

type Tags

type Tags interface {
	GetEncoder() string
}

Tags ...

type Transcoder

type Transcoder interface {
	Start(optsBeforeInput Options, opts Options) (<-chan Progress, error)
	StartAndReturnCmd(optsBeforeInput Options, opts Options) (<-chan Progress, *exec.Cmd, error)
	Input(i string) Transcoder
	InputPipe(w *io.WriteCloser, r *io.ReadCloser) Transcoder
	Output(o string) Transcoder
	OutputPipe(w *io.WriteCloser, r *io.ReadCloser) Transcoder
	WithOptions(opts Options) Transcoder
	WithAdditionalOptions(opts Options) Transcoder
	GetMetadata() (Metadata, error)
}

Transcoder ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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