dturing / node-gstreamer-superficial

Superficial gstreamer binding
MIT License
130 stars 45 forks source link

Add appsrc push & caps functionality #21

Closed Zubnix closed 6 years ago

Zubnix commented 7 years ago

Working example shows a red 'movie':


const gstreamer = require('./build/Release/gstreamer-superficial')

const pipeline = new gstreamer.Pipeline('appsrc name=mysource is-live=true ! ' +
    'videoconvert ! video/x-raw,format=I420,width=640,height=480 !' +
    'x264enc byte-stream=true key-int-max=30 pass=pass1 tune=zerolatency threads=2 ip-factor=2 speed-preset=veryfast intra-refresh=0 qp-max=43 !' +
    'video/x-h264,profile=constrained-baseline,stream-format=byte-stream,framerate=0/1 !' +
    'openh264dec !' +
    'autovideosink');

const appsrc = pipeline.findChild('mysource')
appsrc.setCapsFromString("video/x-raw,format=RGB,width=640,height=480,bpp=24,depth=24,framerate=0/1")
pipeline.play()

function frame() {
    appsrc.push(Buffer.alloc(640 * 480 * 3, "ff0000","hex"))
    setTimeout(frame, 33)
}

frame()
dturing commented 7 years ago

Very nice, thank you! I'll have a look and merge shortly.

Zubnix commented 6 years ago

Any love? I'd like to start using it myself without relying on my own fork.

dturing commented 6 years ago

Sorry for the delay. I merged your contribution and released a new version on npm.

Thanks again!