Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Go bindings for x264

License

NotificationsYou must be signed in to change notification settings

gen2brain/x264-go

Repository files navigation

Build StatusGoDocGo Report Card

x264-go provides H.264/MPEG-4 AVC codec encoder based onx264 library.

C source code is included in package. If you want to use external shared/static library (i.e. built with asm and/or OpenCL) use-tags extlib

Installation

go get -u github.com/gen2brain/x264-go

Build tags

  • extlib - use external x264 library
  • pkgconfig - enable pkg-config (used with extlib)

Examples

Seescreengrab example.

Usage

package mainimport ("bytes""image""image/color""image/draw""github.com/gen2brain/x264-go")funcmain() {buf:=bytes.NewBuffer(make([]byte,0))opts:=&x264.Options{Width:640,Height:480,FrameRate:25,Tune:"zerolatency",Preset:"veryfast",Profile:"baseline",LogLevel:x264.LogDebug,}enc,err:=x264.NewEncoder(buf,opts)iferr!=nil {panic(err)}img:=x264.NewYCbCr(image.Rect(0,0,opts.Width,opts.Height))draw.Draw(img,img.Bounds(),image.Black,image.ZP,draw.Src)fori:=0;i<opts.Width/2;i++ {img.Set(i,opts.Height/2, color.RGBA{255,0,0,255})err=enc.Encode(img)iferr!=nil {panic(err)}}err=enc.Flush()iferr!=nil {panic(err)}err=enc.Close()iferr!=nil {panic(err)}}

More

For AAC encoder seeaac-go.

About

Go bindings for x264

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp