https://github.com/lesomnus/gstpl
Simple GStreamer pipeline launcher for Go.
https://github.com/lesomnus/gstpl
gst gst-launch gstreamer multimedia video-streaming
Last synced: about 2 months ago
JSON representation
Simple GStreamer pipeline launcher for Go.
- Host: GitHub
- URL: https://github.com/lesomnus/gstpl
- Owner: lesomnus
- License: apache-2.0
- Created: 2023-05-25T17:57:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-16T10:12:30.000Z (almost 2 years ago)
- Last Synced: 2025-01-27T23:36:07.708Z (4 months ago)
- Topics: gst, gst-launch, gstreamer, multimedia, video-streaming
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gstpl
Simple GStreamer pipeline launcher for Go.
## Example
```go
import (
"errors"
"time""github.com/lesomnus/gstpl"
)func main() {
// GStreamer pipeline expression;
// for example:
// expr := `v4l2src device=/dev/video0
// ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1
// ! videoconvert
// ! x264enc speed-preset=ultrafast tune=zerolatency bitrate=500
// `
expr := "videotestsrc"pl, err := gstpl.NewPipeline(expr)
if err != nil {
panic(err)
}if err := pl.Start(); err != nil {
panic(err)
}go func() {
time.Sleep(10 * time.Second)// `Close` will unblock `Recv` with `io.EOF`.
if err := pl.Close(); err != nil {
panic(err)
}
}()
for {
sample, err := pl.Recv()
if err != nil {
if errors.is(err, io.EOF) {
break
}
panic(err)
}// Do cool things with `sample`.
}
}
```