ffmpeg

package
v0.0.0-...-f0b9b21 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTranscodeOptions = TranscodeOptions{
	InputOptions: []string{
		"-hwaccel", "auto",
	},
	OutputOptions: []string{
		"-f", "mp4",
		"-c:v", "libx264",
		"-crf", "18",
		"-preset", "fast",
		"-c:a", "aac",
		"-tune", "animation",
		"-threads", "0",
	},
}

DefaultTranscodeOptions are the default options.

Functions

func CreateArgs

func CreateArgs(ctx context.Context, source, destination string, tOptions TranscodeOptions) (args []string, duration float64, err error)

func Transcode

func Transcode(ctx context.Context, source, destination string, tOptions TranscodeOptions) (
	progress chan Progress,
	done chan error,
)

Transcode is specifically created to transcode video files which require some sort of burnt subtitles. It'll check for available streams in our source and if it contains a subtitle stream, it'll burn the subtitles (hardsub) otherwise it'll leave it and assume that the video already contains hardsubs. NOTE: assumes you have 'ffmpeg' in your PATH environment variables

Types

type Progress

type Progress struct {
	FramesProcessed string  `json:"framesProcessed"`
	CurrentTime     string  `json:"currentTime"`
	CurrentBitrate  string  `json:"currentBitrate"`
	Percentage      float64 `json:"percantage"`
	Speed           float64 `json:"speed"`
	Duration        float64 `json:"duration"`
	CurrentDuration float64 `json:"currentDuration"`
}

Progress defines a transcode progress.

type TranscodeOptions

type TranscodeOptions struct {
	InputOptions  []string
	OutputOptions []string
}

TranscodeOptions are options. InputOptions are options defined before the source. OutputOptions are options defined after the video filters as mappings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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