Giter VIP home page Giter VIP logo

gstreamer-go's Introduction

gstreamer-go

gstreamer simple wrap for golang

Install

Ubuntu or Dedian

apt-get install pkg-config
apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-libav

Mac os

brew install gstreamer
brew install gst-plugins-base
brew install gst-plugins-good
brew install gst-plugins-bad
brew install gst-plugins-ugly

Then

go get github.com/notedit/gstreamer-go

How to use

pipeline, err := New("videotestsrc  ! capsfilter name=filter ! autovideosink")
if err != nil {
    t.Error("pipeline create error", err)
    t.FailNow()
}

filter := pipeline.FindElement("filter")

if filter == nil {
    t.Error("pipeline find element error ")
}

filter.SetCap("video/x-raw,width=1280,height=720")

pipeline.Start()

Send Media data to pipeline

pipeline, err := New("appsrc name=mysource format=time is-live=true do-timestamp=true ! videoconvert ! autovideosink")

if err != nil {
    t.Error("pipeline create error", err)
    t.FailNow()
}

appsrc := pipeline.FindElement("mysource")

appsrc.SetCap("video/x-raw,format=RGB,width=320,height=240,bpp=24,depth=24")

pipeline.Start()

for {
    time.Sleep(1 * time.Second)
    appsrc.Push(make([]byte, 320*240*3))
}

push raw rgb data to the pipeline

Poll Media data from pipeline

pipeline, err := New("videotestsrc ! video/x-raw,format=I420,framerate=15/1 ! x264enc bframes=0 speed-preset=veryfast key-int-max=60 ! video/x-h264,stream-format=byte-stream ! appsink name=sink")

if err != nil {
    t.Error("pipeline create error", err)
    t.FailNow()
}

appsink := pipeline.FindElement("sink")

pipeline.Start()

out := appsink.Poll()

for {
    buffer := <-out
    fmt.Println("push ", len(buffer))
}

now we can get the h264 raw data from the pipeline

Check Plugins does exist

	
plugins := []string{"videotestsrc", "audiotestsrc", "rtp", "curl","x264", "rtmp"}

err := CheckPlugins(plugins)

if err != nil {
    panic(err)
}

gstreamer-go's People

Contributors

jackdallas avatar notedit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gstreamer-go's Issues

No license file

Can you add a license file? Preferably the MIT license.
Thank you!

Sincerely,
Quinten

compilation error on windows

whenever I try to run
go run main.go
I get the following error.
github.com/notedit/gstreamer-go: build constraints exclude all Go files

build constraints exclude all Go files

Hi,I try this go module in ARM, but get the err as follows:
go build github.com/notedit/gstreamer-go: build constraints exclude all Go files in /home/z/go/src/github.com/notedit/gstreamer-go
Is there anything I should pay attention to?

Compilation error on MacOS

Getting this error when trying to compile on MacOS 12.6 (Intel), GoLang 1.19.2

# github.com/notedit/gst
../../../go/pkg/mod/github.com/notedit/[email protected]/element_other.go:14:96: cannot use _Ctype_long(duration.Nanoseconds()) (value of type _Ctype_long) as type _Ctype_longlong in variable declaration
make: *** [build] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.