https://github.com/octu0/go-xevd
Go bindings for mpeg5/xevd
https://github.com/octu0/go-xevd
binding evc golang video-codec
Last synced: 8 months ago
JSON representation
Go bindings for mpeg5/xevd
- Host: GitHub
- URL: https://github.com/octu0/go-xevd
- Owner: octu0
- License: bsd-3-clause
- Created: 2022-09-19T12:36:09.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-20T14:11:31.000Z (about 3 years ago)
- Last Synced: 2024-12-30T03:43:19.711Z (9 months ago)
- Topics: binding, evc, golang, video-codec
- Language: Go
- Homepage: https://pkg.go.dev/github.com/octu0/go-xevd
- Size: 319 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `go-xevd`
[](https://github.com/octu0/go-xevd/blob/master/LICENSE)
[](https://godoc.org/github.com/octu0/go-xevd)
[](https://goreportcard.com/report/github.com/octu0/go-xevd)
[](https://github.com/octu0/go-xevd/releases)Go bindings for [mpeg5/xevd](https://github.com/mpeg5/xevd)
MPEG-5 EVC decoder.## Requirements
requires xevd [install](https://github.com/mpeg5/xevd#how-to-build) on your system
```
$ git clone https://github.com/mpeg5/xevd.git
$ cd xevd
$ mkdir build
$ cd build
$ cmake .. -DSET_PROF=BASE
$ make
$ make install
```## Usage
### Decode
```go
import "github.com/octu0/go-xevd"func main() {
decoder, err := xevd.CreateDefaultBaselineDecoder()
if err != nil {
panic(err)
}
defer decoder.Close()f, err := os.Open("./testdata/src.evc")
if err != nil {
panic(err)
}
defer f.Close()br := bufio.NewReader(f)
if err := decoder.DecodeStream(br, func(buf *xevd.DecodeImageBuffer) {
defer buf.Close()fmt.Printf("Frame:%s Slice:%s color:%s\n", buf.NALUnit, buf.Slice, buf.ColorSpace)
// => Frame:IDR Slice:I color:YCbCr420if err := saveImage(buf.Img); err != nil {
panic(err)
}
}); err != nil {
panic(err)
}
}func saveImage(img image.Image) (string, error) {
out, err := os.CreateTemp("/tmp", "out*.png")
if err != nil {
return "", err
}
defer out.Close()if err := png.Encode(out, img); err != nil {
return "", err
}
return out.Name(), nil
}
```