mpeg

An experimental pure-golang MPEG-2 decoder implementation

  • 所有者: 32bitkid/mpeg
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

mpeg

Package mpeg provides an implementation of an experimental
pure golang implementation of an MPEG-2 decoder. It
is intended as an educational look at some of the patterns and
algorithms involved in the ubiquitous technology of video
compression/decompression.

This package is experimental and is not intended for
use in production environments.

GoDoc

Composition

This library is split into four sub-packages:

  • mpeg/ts for parsing and processing MPEG-2 Transport Streams
  • mpeg/ps for parsing and processing MPEG-2 Program Streams
  • mpeg/pes for parsing and processing MPEG-2 Packetized Elementary Streams
  • mpeg/video for decoding MPEG-2 Video

Examples

Give it a spin!

go get -d github.com/32bitkid/mpeg

Decode a frame of video from a MPEG-2 TS and save it as a png

package main

import "os"
import "image/png"

import "github.com/32bitkid/mpeg/ts"
import "github.com/32bitkid/mpeg/pes"
import "github.com/32bitkid/mpeg/video"

func main() {
  // Open the file
  tsReader, err := os.Open("source.ts")

  // Decode PID 0x21 from the TS stream
  pesReader := ts.NewPayloadUnitReader(tsReader, ts.IsPID(0x21))

  // Decode the PES stream
  esReader := pes.NewPayloadReader(pesReader)

  // Decode the ES into a stream of frames
  v := video.NewVideoSequence(esReader)

  // Align to next sequence start/entry point
  v.AlignTo(video.SequenceHeaderStartCode)

  // get the next frame
  frame, _ = v.Next()
  file, _ := os.Create("output.png")
  png.Encode(file, frame)
}

主要指标

概览
名称与所有者32bitkid/mpeg
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2014-07-14 01:33:48
推送于2024-06-08 02:37:51
最后一次提交2024-06-07 20:37:50
发布数0
用户参与
星数92
关注者数7
派生数15
提交数329
已启用问题?
问题数1
打开的问题数1
拉请求数1
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?