ffthumb

package module
v0.0.0-...-04eed6c Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 12 Imported by: 0

README

ffthumb

What does it do?

Given a video file, ffthumb chooses a thumbnail image by extracting the first few keyframes and selecting the largest and least compressible file.

ffmpeg is used for keyframe extraction and is not provided.

ffprobe is used to determine if aspect ratio correction is required, and is also not provided.

Documentation: https://godoc.org/github.com/7fffffff/ffthumb

Why not just use the first frame?

Sometimes the first frame makes for a poor thumbnail, because it's all one color or something like that.

Documentation

Overview

Package ffthumb provides a utility for finding an "interesting" thumbnail frame from a video file. FFmpeg (https://www.ffmpeg.org) is required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Thumbnailer

type Thumbnailer struct {
	Num         int    // number of candidate thumbnails
	FFmpegPath  string // path to ffmpeg
	FFprobePath string // path to ffprobe
}

func (*Thumbnailer) LookupExec

func (p *Thumbnailer) LookupExec()

LookupExec fills in FFmpegPath or FFprobePath if either is empty, by calling exec.LookPath to find the binaries in PATH

func (*Thumbnailer) WriteThumbnail

func (p *Thumbnailer) WriteThumbnail(ctx context.Context, output io.Writer, inputPath string) error

WriteThumbnail writes a png image to output, with the same dimensions as the input video.

WriteThumbnail chooses a thumbnail from a video file by creating Num thumbnails, then choosing the largest (in terms of file size). This is based on the idea that the largest, least compressible thumbnail image is likely to contain something interesting to look at.

FFmpegPath and FFprobePath must be set before calling WriteThumbnail.

Directories

Path Synopsis
cmd
ffthumb
Example command line program using ffthumb.
Example command line program using ffthumb.

Jump to

Keyboard shortcuts

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