giffer

package module
v0.0.0-...-cca73eb Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 16 Imported by: 0

README

Giffer

Create gifs from videos!

Take a look

usage animation

input

loading

complete

Tech

  • Go (gioui.org)
  • FFmepg

About

Giffer provides a simple UI for converting slices of video to animated GIF images.

Install

go get github.com/jackmordaunt/giffer/cmd/gio

Enhancements

  • avoid downloading entire video
    • only download the portion that is needed for the GIF
  • show error toasts instead of just logging to console

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdPipe

type CmdPipe struct {
	In    io.Reader
	Out   io.Writer
	Stack []*exec.Cmd

	Debug bool
}

CmdPipe executes a stack of commands, piping in order.

func (CmdPipe) Run

func (p CmdPipe) Run() (err error)

Run the commands.

type Downloader

type Downloader struct {
	Dir    string
	FFmpeg string
	Debug  bool
	Out    io.Writer
}

Downloader is responsible for downloading videos.

func (Downloader) Download

func (dl Downloader) Download(
	URL string,
	start, end float64,
) (string, error)

Download the video from URL into Dir and return the full path to the downloaded file.

type Engine

type Engine struct {
	Dir     string    // Directory to write temporary files.
	FFmpeg  string    // Path to FFmpeg binary.
	Convert string    // Path to imagemagick Convert binary.
	Debug   bool      // Print commands used.
	Out     io.Writer // Writer to use if debug is true.
	Junk    []string  // Temporary files to cleanup.
	// contains filtered or unexported fields
}

Engine implements video and image manipulation.

func (*Engine) Clean

func (eng *Engine) Clean()

Clean the temporary files.

func (*Engine) Crush

func (eng *Engine) Crush(gif string, fuzz int) error

Crush reduces the file size of a gif image. Accepts a filepath to the gif image and replaces it with the crushed gif. Fuzz is a percentage value between 0 and 100, where 0 is best quality, 100 is smallest file size. Optimal is typically 2-5.

func (*Engine) Cut

func (eng *Engine) Cut(video string, cuts ...[2]int) (string, error)

Cut and merge the target file into the specified time slices. Cuts is a slice of int pairs which are start and end times (in seconds) respectively. Returns a filepath to the merged file.

func (*Engine) Transcode

func (eng *Engine) Transcode(
	video string,
	start, end float64,
	width, height int,
	fps float64,
) (string, error)

Transcode the target video file into a gif. Returns a filepath to the gif image.

Directories

Path Synopsis
cmd
build
build functions as a build script, building and bundling the package.
build functions as a build script, building and bundling the package.
cli
gio

Jump to

Keyboard shortcuts

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