h264

所属分类:流媒体/Mpeg4/MP4
开发工具:GO
文件大小:3KB
下载次数:0
上传日期:2017-01-23 22:49:50
上 传 者sh-1993
说明:  ffmpeg h264编解码器绑定
(ffmpeg h264 codec bindings)

文件列表:
h264dec.go (1860, 2017-01-24)
h264enc.go (3119, 2017-01-24)
util.go (670, 2017-01-24)

h2*** [![GoDoc](http://godoc.org/github.com/opennota/h2***?status.svg)](http://godoc.org/github.com/opennota/h2***) ==== H2*** encoder and decoder using ffmpeg. H2*** encoding example: ```go w := 400 h := 400 var nal [][]byte c, _ := h2***.NewEncoder(w, h, image.YCbCrSubsampleRatio420) nal = append(nal, c.Header) for i := 0; i < 60; i++ { img := image.NewYCbCr(image.Rect(0,0,w,h), image.YCbCrSubsampleRatio420) p, _ := c.Encode(img) if len(p.Data) > 0 { nal = append(nal, p.Data) } } for { // flush encoder p, err := c.Encode(nil) if err != nil { break } nal = append(nal, p.Data) } ``` H2*** decoding example: ```go dec, err := h2***.NewDecoder(nal[0]) for i, n := range nal[1:] { img, err := dec.Decode(n) if err == nil { fp, _ := os.Create(fmt.Sprintf("/tmp/dec-%d.jpg", i)) jpeg.Encode(fp, img, nil) fp.Close() } } ``` License ---- All code is under WTFPL. You can use it for everything as you want :)

近期下载者

相关文件


收藏者