• Stars
    star
    304
  • Rank 132,017 (Top 3 %)
  • Language
    Go
  • License
    Creative Commons ...
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎨 Go AVIF library

go-avif Build Status GoDoc

go-avif implements AVIF (AV1 Still Image File Format) encoder for Go using libaom, the high quality AV1 codec.

Requirements

Make sure libaom is installed. On typical Linux distro just run:

Debian (and derivatives):

sudo apt-get install libaom-dev

RHEL (and derivatives):

sudo dnf install libaom-devel

Usage

To use go-avif in your Go code:

import "github.com/Kagami/go-avif"

To install go-avif in your $GOPATH:

go get github.com/Kagami/go-avif

For further details see GoDoc documentation.

Example

package main

import (
	"image"
	_ "image/jpeg"
	"log"
	"os"

	"github.com/Kagami/go-avif"
)

func main() {
	if len(os.Args) != 3 {
		log.Fatalf("Usage: %s src.jpg dst.avif", os.Args[0])
	}

	srcPath := os.Args[1]
	src, err := os.Open(srcPath)
	if err != nil {
		log.Fatalf("Can't open sorce file: %v", err)
	}

	dstPath := os.Args[2]
	dst, err := os.Create(dstPath)
	if err != nil {
		log.Fatalf("Can't create destination file: %v", err)
	}

	img, _, err := image.Decode(src)
	if err != nil {
		log.Fatalf("Can't decode source file: %v", err)
	}

	err = avif.Encode(dst, img, nil)
	if err != nil {
		log.Fatalf("Can't encode source image: %v", err)
	}

	log.Printf("Encoded AVIF at %s", dstPath)
}

CLI

go-avif comes with handy CLI utility avif. It supports encoding of JPEG and PNG files to AVIF:

# Compile and put avif binary to $GOPATH/bin
go get github.com/Kagami/go-avif/...

# Encode JPEG to AVIF with default settings
avif -e cat.jpg -o kitty.avif

# Encode PNG with slowest speed
avif -e dog.png -o doggy.avif --best -q 15

# Lossless encoding
avif -e pig.png -o piggy.avif --lossless

# Show help
avif -h

Static 64-bit builds for Windows, macOS and Linux are available at releases page. They include latest libaom from git at the moment of build.

Display

To display resulting AVIF files take a look at software listed here. E.g. use avif.js web viewer.

License

go-avif is licensed under CC0.

More Repositories

1

ffmpeg.js

Port of FFmpeg with Emscripten
JavaScript
3,160
star
2

go-face

πŸ” Face recognition with Go
Go
1,052
star
3

avif.js

:shipit: AVIF polyfill for the browser
JavaScript
662
star
4

webm.js

JavaScript WebM converter
JavaScript
452
star
5

boram

🎞️ Cross-platform graphical WebM converter
JavaScript
428
star
6

mpv.js

πŸŽ₯ mpv pepper plugin
C++
395
star
7

vmsg

🎡 Library for creating voice messages
JavaScript
337
star
8

gulp-ng-annotate

πŸ“Œ Add angularjs dependency injection annotations with ng-annotate
JavaScript
265
star
9

webm.py

🎞️ Cross-platform command-line WebM converter
Python
142
star
10

chaptcha

Break 2ch CAPTCHA using OpenCV and FANN
Python
85
star
11

mpv_slicing

Cut video fragments with mpv
Lua
76
star
12

wybm

βœ‚οΈ Extract and cut youtube webms
JavaScript
56
star
13

dav1d.js

βš—οΈ WebAssembly AV1 decoder
C
31
star
14

tistore

πŸ“· Tistory photo grabber
JavaScript
23
star
15

kagome

Application cage
Shell
19
star
16

mpv_frame_info

Show frame info with mpv
Lua
16
star
17

go-face-testdata

πŸ—ƒοΈ Test data for go-face
14
star
18

github-social-graph

Build simple social graphs for GitHub
Python
14
star
19

video-tools

Various video tools
Jupyter Notebook
13
star
20

kisa

XMPP stress tool
Python
13
star
21

bnw-meow

Kawaii single-page web interface for BnW
CoffeeScript
11
star
22

docker_cve-2015-2925

Docker + CVE-2015-2925 = escaping from --volume
10
star
23

nacl_sdk

🍴 Fork of Native Client SDK
Python
9
star
24

wasm-polyfill.js

🍴 Fork of rfk's project
JavaScript
9
star
25

av1-bench

🏎️ AV1 encoders benchmarks
Python
8
star
26

dotfiles

Dotfiles the easy way
Vim Script
6
star
27

jade-pages-brunch

Adds Jade static pages support to brunch
CoffeeScript
6
star
28

kpopnet

[MOVED]
Go
6
star
29

ng-annotate-uglify-js-brunch

Adds ng-annotate AND UglifyJS support to brunch
JavaScript
4
star
30

SVT-AV1

🍴 Welcome to the GitHub repo for the SVT-AV1 encoder! To see a list of feature request and view what is planned for the SVT-AV1 encoder, visit our Trello page: bit.ly/SVT-AV1 Help us grow the community by subscribing to our SVT-AV1 mailing list! http://bit.ly/svt-av1-mailing
C
4
star
31

jade-ngtemplates-brunch

Adds Jade AngularJS templates support to brunch
CoffeeScript
3
star
32

awesome-cloud-cli

A curated list of useful CLI tools for cloud hostings
JavaScript
3
star
33

hangeul.js

πŸ‡°πŸ‡· Hangeul transliteration library
JavaScript
2
star
34

cirno

(OBSOLETE) Dumb XMPP library, the successor of the XMPP lib
Haskell
2
star
35

dogfood

πŸ”© Basic blocks of operating system
C
2
star
36

parcel-plugin-disable-loaders

πŸ“¦ Allow to disable parcel loaders
JavaScript
2
star
37

webmify

Allow to watch WebMs in Edge
JavaScript
2
star
38

web-bench

Benchmarks for various web platforms
Perl
2
star
39

ninnin

🎞️ mpv-based video encoding tool
TypeScript
2
star
40

shitsu

Tiny and flexible XMPP bot framework
Python
2
star
41

skip-loader

A loader that returns an empty string module
JavaScript
1
star
42

lame-svn

Git mirror
C
1
star
43

gulp-recipes

Tiny gulp recipes
1
star