go_vlc_thumbnail

package module
v0.0.0-...-637c7af Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 10 Imported by: 0

README

go-vlc-thumbnail

Godoc

This package uses CVLC (command line VLC) to create thumbnails or snapshots from video files.

Requirements

  • Linux (Windows and MacOS will be added in the future)
  • VLC installed on the host

Usage

See this page.

Documentation

Index

Constants

View Source
const (
	FORMAT_JPEG = pictureOutputFormat(iota)
	FORMAT_PNG
	FORMAT_TIFF
)

Variables

View Source
var CVLCBinPath string

CVLCBinPath holds the location of the CVLC executable binary.

View Source
var DisableHardwareAudioVideoCodec = true

DisableHardwareAudioVideoCodec forces the CPU to do encoding, this may solve problems with nvidia drivers on Linux.

View Source
var TempWorkDir string

TempWorkDir is the location where VLC will temporarily save the snapshot to. Default is the process work dir (PWD).

Functions

This section is empty.

Types

type Video

type Video struct {
	Source       string              // Path to the video file
	OutputFormat pictureOutputFormat // The output format of the thumbnail, default is FORMAT_JPEG
	Time         int                 // Which second of the video a snapshot is to be created of
	// contains filtered or unexported fields
}

Video structure defines which file (Source) to create a snapshot of. Valid OutputFormat arguments are FORMAT_JPEG, FORMAT_PNG, FORMAT_TIFF. The Time defines which second of the given Source a snapshot should be made.

func (Video) CommandLog

func (tf Video) CommandLog() (stdout, stderr bytes.Buffer)

CommandLog returns the stdout and stderr output of the exec.Command("cvlc", ...). This can be useful for debugging any errors not caught by this package. Will only contain logs after calling Generate() or GenerateTo().

func (*Video) Generate

func (tf *Video) Generate() (file []byte, err error)

Generate returns a snapshot in the given OutputFormat from the Source in a byte slice or an error.

func (*Video) GenerateTo

func (tf *Video) GenerateTo(saveLocation string) error

GenerateTo generates a snapshot in the given OutputFormat from the Source and saves it to the given saveLocation if the returned error is nil. No file extension (eg .jpg) will be added to the saveLocation path. It's up to the user to do this.

Jump to

Keyboard shortcuts

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