modulepackage
2.0.0-20241004220354-281651c51a60
Repository: https://github.com/parallax4/thumbnailer.git
Documentation: pkg.go.dev
# README
thumbnailer
Package thumbnailer provides a more efficient media thumbnailer than available with native Go processing libraries through ffmpeg bindings.
Use
go get -u github.com/bakape/thumbnailer/v2
to install the library in your project.
For a comprehensive list of file formats supported by default see main.go:Process().
Dependencies
- Go >= 1.10
- C11 compiler
- make
- pkg-config
- pthread
- ffmpeg >= 4.1 libraries (libavcodec, libavutil, libavformat, libswscale)
NB:
- ffmpeg should be compiled with all the dependency libraries for formats you want to process. On most Linux distributions you should be fine with the packages in the stock repositories.
- Ubuntu patches to ffmpeg on some Ubuntu versions <19.10 break this library. In this case, please compile from unmodified ffmpeg sources using:
sudo apt build-dep ffmpeg
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
git checkout n4.1
./configure
make -j`nproc`
sudo make install
# Functions
DetectMIME detects the MIME typ of the rs.
Process generates a thumbnail from a file of unknown type and performs some basic meta information extraction.
RegisterMatcher adds an extra magic prefix-based MIME type matcher to the default set with an included canonical file extension.
RegisterProcessor registers a file processor for a specific MIME type.
# Interfaces
Matcher takes up to the first 4 KB of a file and returns the MIME type and canonical extension, that were matched.
# Type aliases
MatcherFunc is an adapter that allows using functions as Matcher.
Processor is a specialized file processor for a specific file type.