gst-launch + alpha

Alain Culos gstreamer at asoundmove.net
Wed Apr 8 17:14:43 UTC 2020


Thank you both Ederson & Arnaud,

This pipeline now works without error messages:

w=1280; h=800; x0=450; y0=200; gst-launch-1.0
    v4l2src device=/dev/video0 \
    ! videocrop left=$x0 right=$(( 1920 - $w - $x0 )) top=$y0 bottom=$(( 1080 - $h - $y0 )) \
    ! alpha method=green angle=70 \
    ! queue \
    ! mixer.sink_1 \
    \
    ximagesrc xid=0x06600003 use-damage=false \
    ! videoscale \
    ! video/x-raw,width=$w,height=$h \
    ! queue \
    ! mixer.sink_0 \
    \
    videomixer name=mixer sink_0::zorder=0 sink_1::zorder=1 \
    ! videoconvert \
    ! autovideosink -v sync=false

The time-lag is significant and the displayed framerate is poor (maybe 5/1 to 10/1), but it works.
Note that my desktop hardly works at all (overall CPU well below 10%, 1 of 12 cores at 10-20% max).

1/ It would be great if someone could chime in with ideas to help improve the real-time performance of this pipeline - ideally resulting in a framerate of at least 15 or 20.

2/ My next step is to use the "alpha" element properly.
With the pipeline above my green screen gets replaced with a shaded background - i.e. alpha is not 0 or 1, but something in between.
I already pushed the "angle" value as far as I can get without becoming semi-transparent myself.
How do I increase the alpha channel values without becoming transparent?

Thanks,
Alain.


On Wed, 8 Apr 2020, at 13:27, Arnaud Loonstra wrote:
> On 08-04-2020 12:38, Alain Culos wrote:
> [big snip]
> 
> I tried your pipeline but couldn't get it to work. I think it'll run a 
> lot smoother by adding sync=false to your imagesink.
> 
> I'm also trying to create something like your setup. We could definitely 
> use something for linux like camtwist on OSX. It should be easily doable 
> with gstreamer and v4l2loopback. It's quite tricky to get stuff like 
> this working with gst-launch. I just played a bit with pipeviz and 
> imediatelly got two streams working with the videomixer.
> 
> https://github.com/virinext/pipeviz
> 
> Rg,
> Arnaud

How does my pipeline fail for you?
If it fails on v4l2src, try autoviedosrc instead.
If it fails on ximagesrc, it could be because you have the wrong window id?
You can drop the videocrop this is to extract the portion of the webcam video of interest to me (zooming in) - and with it you can drop the videoscale and caps to rescale the ximagesrc.
You can drop the alpha, it should work similarly, albeit without green screen replacement, but that would test the pipeline with more simplicity.
Check your window ids with "wmctrl -l".


On Wed, 8 Apr 2020, at 17:14, Desouza, Ederson wrote:
> Your pipeline does work for me (I just need to scale v4l2src output, as
> it doesn't output a big enough video for you parameters). I'm afraid
> I'm out of ideas now... =/

Different webcams, I suppose. Mine is a 1080p.


More information about the gstreamer-devel mailing list