generate

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package generate provides functions to generate media assets from scenes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FFMpegConfig added in v0.19.0

type FFMpegConfig interface {
	GetTranscodeInputArgs() []string
	GetTranscodeOutputArgs() []string
}

type Generator

type Generator struct {
	Encoder      *ffmpeg.FFMpeg
	FFMpegConfig FFMpegConfig
	LockManager  *fsutil.ReadLockManager
	MarkerPaths  MarkerPaths
	ScenePaths   ScenePaths
	Overwrite    bool
}

func (Generator) CombineSpriteImages

func (g Generator) CombineSpriteImages(images []image.Image) image.Image

func (Generator) MarkerPreviewVideo

func (g Generator) MarkerPreviewVideo(ctx context.Context, input string, hash string, seconds int, includeAudio bool) error

func (Generator) PreviewVideo

func (g Generator) PreviewVideo(ctx context.Context, input string, videoDuration float64, hash string, options PreviewOptions, fallback bool, useVsync2 bool) error

func (Generator) PreviewWebp

func (g Generator) PreviewWebp(ctx context.Context, input string, hash string) error

PreviewWebp generates a webp file based on the preview video input. TODO - this should really generate a new webp using chunks.

func (Generator) SceneMarkerScreenshot

func (g Generator) SceneMarkerScreenshot(ctx context.Context, input string, hash string, seconds int, width int) error

func (Generator) SceneMarkerWebp

func (g Generator) SceneMarkerWebp(ctx context.Context, input string, hash string, seconds int) error

func (Generator) Screenshot

func (g Generator) Screenshot(ctx context.Context, input string, videoWidth int, videoDuration float64, options ScreenshotOptions) ([]byte, error)

func (Generator) SpriteScreenshot

func (g Generator) SpriteScreenshot(ctx context.Context, input string, seconds float64) (image.Image, error)

func (Generator) SpriteScreenshotSlow

func (g Generator) SpriteScreenshotSlow(ctx context.Context, input string, frame int) (image.Image, error)

func (Generator) SpriteVTT

func (g Generator) SpriteVTT(ctx context.Context, output string, spritePath string, stepSize float64) error

func (Generator) Transcode

func (g Generator) Transcode(ctx context.Context, input string, hash string, options TranscodeOptions) error

func (Generator) TranscodeAudio

func (g Generator) TranscodeAudio(ctx context.Context, input string, hash string) error

TranscodeAudio will copy the video stream as is, and transcode audio.

func (Generator) TranscodeCopyVideo

func (g Generator) TranscodeCopyVideo(ctx context.Context, input string, hash string) error

TranscodeCopyVideo will copy the video stream as is, and drop the audio stream.

func (Generator) TranscodeVideo

func (g Generator) TranscodeVideo(ctx context.Context, input string, hash string, options TranscodeOptions) error

TranscodeVideo transcodes the video, and removes the audio. In some videos where the audio codec is not supported by ffmpeg, ffmpeg fails if you try to transcode the audio

type MarkerPaths

type MarkerPaths interface {
	Paths

	GetVideoPreviewPath(checksum string, seconds int) string
	GetWebpPreviewPath(checksum string, seconds int) string
	GetScreenshotPath(checksum string, seconds int) string
}

type Paths

type Paths interface {
	TempFile(pattern string) (*os.File, error)
}

type PreviewOptions

type PreviewOptions struct {
	Segments        int
	SegmentDuration float64
	ExcludeStart    string
	ExcludeEnd      string

	Preset string

	Audio bool
}

type SceneMarkerScreenshotOptions

type SceneMarkerScreenshotOptions struct {
	Seconds int
	Width   int
}

type ScenePaths

type ScenePaths interface {
	Paths

	GetVideoPreviewPath(checksum string) string
	GetWebpPreviewPath(checksum string) string

	GetSpriteImageFilePath(checksum string) string
	GetSpriteVttFilePath(checksum string) string

	GetTranscodePath(checksum string) string
}

type ScreenshotOptions

type ScreenshotOptions struct {
	At *float64
}

type TranscodeOptions

type TranscodeOptions struct {
	Width  int
	Height int
}

Jump to

Keyboard shortcuts

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