framereader

package module
v0.0.0-...-0d93635 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2017 License: MIT Imports: 4 Imported by: 0

README

go-framereader

A simple API to Iterate over video frames sent over STDIN using MJPEG or PPM formats. The resulting frames are OpenCV Image objects.

Example

import (
    "github.com/caioariede/go-framereader"
    "github.com/lazywei/go-opencv/opencv"
)

func main() {
    win := opencv.NewWindow("GoOpenCV: VideoPlayer")
    defer win.Destroy()

    // Read MJPEG stream from STDIN in chunks of 10240 bytes
    reader := framereader.MJPEGStdinReader(10240)

    for image := range reader {
        win.ShowImage(image)
        opencv.WaitKey(1000)
    }
}
Running
MJPEG
ffmpeg -i VIDEO.mp4 -qscale:v 2 -vcodec mjpeg -f image2pipe -pix_fmt yuvj420p - | ./example
PPM
ffmpeg -i VIDEO.mp4 -f image2pipe -qscale:v 2 -vcodec ppm | ./example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeImageMem

func DecodeImageMem(data []byte) *opencv.IplImage

func MJPEGStdinReader

func MJPEGStdinReader(bufsize int) (ch chan *opencv.IplImage)

func PPMStdinReader

func PPMStdinReader(bufsize int) (ch chan *opencv.IplImage)

func VideoFileReader

func VideoFileReader(filename string) (ch chan *opencv.IplImage)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL