• Stars
    star
    323
  • Rank 130,051 (Top 3 %)
  • Language
    Go
  • License
    Creative Commons ...
  • Created almost 6 years ago
  • Updated over 2 years 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,299
star
2

go-face

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

avif.js

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

webm.js

JavaScript WebM converter
JavaScript
456
star
5

boram

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

mpv.js

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

vmsg

🎡 Library for creating voice messages
JavaScript
348
star
8

gulp-ng-annotate

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

webm.py

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

chaptcha

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

mpv_slicing

Cut video fragments with mpv
Lua
82
star
12

wybm

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

dav1d.js

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

tistore

πŸ“· Tistory photo grabber
JavaScript
24
star
15

kagome

Application cage
Shell
19
star
16

mpv_frame_info

Show frame info with mpv
Lua
18
star
17

video-tools

Various video tools
Jupyter Notebook
16
star
18

go-face-testdata

πŸ—ƒοΈ Test data for go-face
15
star
19

github-social-graph

Build simple social graphs for GitHub
Python
15
star
20

kisa

XMPP stress tool
Python
14
star
21

docker_cve-2015-2925

Docker + CVE-2015-2925 = escaping from --volume
11
star
22

wasm-polyfill.js

🍴 Fork of rfk's project
JavaScript
11
star
23

bnw-meow

Kawaii single-page web interface for BnW
CoffeeScript
10
star
24

nacl_sdk

🍴 Fork of Native Client SDK
Python
10
star
25

av1-bench

🏎️ AV1 encoders benchmarks
Python
9
star
26

dotfiles

Dotfiles the easy way
Vim Script
7
star
27

jade-pages-brunch

Adds Jade static pages support to brunch
CoffeeScript
7
star
28

kpopnet

[MOVED]
Go
7
star
29

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
7
star
30

ng-annotate-uglify-js-brunch

Adds ng-annotate AND UglifyJS support to brunch
JavaScript
5
star
31

jade-ngtemplates-brunch

Adds Jade AngularJS templates support to brunch
CoffeeScript
4
star
32

awesome-cloud-cli

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

ninnin

🎞️ mpv-based video encoding tool
TypeScript
4
star
34

hangeul.js

πŸ‡°πŸ‡· Hangeul transliteration library
JavaScript
3
star
35

cirno

(OBSOLETE) Dumb XMPP library, the successor of the XMPP lib
Haskell
3
star
36

dogfood

πŸ”© Basic blocks of operating system
C
3
star
37

webmify

Allow to watch WebMs in Edge
JavaScript
3
star
38

web-bench

Benchmarks for various web platforms
Perl
3
star
39

parcel-plugin-disable-loaders

πŸ“¦ Allow to disable parcel loaders
JavaScript
3
star
40

shitsu

Tiny and flexible XMPP bot framework
Python
3
star
41

jqw

JQ compiled to WebAssembly
TypeScript
2
star
42

skip-loader

A loader that returns an empty string module
JavaScript
2
star
43

lame-svn

Git mirror
C
2
star
44

gulp-recipes

Tiny gulp recipes
1
star