Skip to content
Scripts for using some ShaderToy shaders in GStreamer
Shell GLSL Makefile Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
Makefile
README
gen-shader-names
gst-shadertoy-cam-1.6.sh
gst-shadertoy-cam-1.8.sh
gst-shadertoy-cam.sh
gst-shadertoy-file-1.6.sh
gst-shadertoy-file-1.8.sh
gst-shadertoy-file.sh
myshader.fs
myshader.vs
shader-id-from-name
shaders.txt
st-dl-orig-shader
st-dl-shader
st-json2code
st-to-gstsh

README

gst-shadertoy
=============


Introduction
------------

gst-shadertoy is a set of scripts for reusing ShaderToy webcam shaders
in a GStreamer pipeline.  This package does not include any GStreamer
plugin, it's only few scripts to download and convert ShaderToy
shaders, and then create a pipeline with already existing elements,
using gst-launch-1.0.

This package does not include or redistributes any shader.  Instead,
shaders will downloaded from the user request.  Please pay attention
to license and author credits while playing with those scripts.

ShaderToy WebCam shaders:
https://www.shadertoy.com/results?filter=webcam

GStreamer glshader element:
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/ext/gl?h=1.14.1
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/ext/gl/gstglfiltershader.c?h=1.14.1


Quick Demonstration
-------------------

Step 1: Make sure you have all required dependencies.  For example, on
a Fedora system:

    sudo dnf install \
        make curl \
        gstreamer1 \
        gstreamer1-plugins-base \
        gstreamer1-plugins-good \
        gstreamer1-plugins-bad-free

Step 2: Download Shaders

    make -j4

Step 3: Run a Shader on your WebCam, for example:

    ./gst-shadertoy-cam.sh Drunk.fs

Step 4: Run a Shader on a movie, for example:

Download a movie, for example "Big Buck Bunny" from:
https://peach.blender.org/download/

    ./gst-shadertoy-file.sh movie.mp4 Glitch.fs


Notes
-----

There is a slight difference on glshader element properties before
GStreamer 1.8.0 and after.  Earlier version takes a shader file path.
Later version takes the shader content directly from the command line.
gst-shadertoy-cam.sh and gst-shadertoy-file.sh will detect your
version and try to execute the best pipeline.

Please note that depending on your GPU and driver, this GStreamer
pipeline could be very resource demanding.  Video size can be reduce
by adding the following elements before the "glupload":

    videoscale ! 'video/x-raw,width=128,height=96,framerate=30/1' ! \

Adjust dimensions and framerate to your needs.

Note also that "glimagesink" window may not always start every time on
some systems.

Moreover a random runtime error can be encountered, with a message:

[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
gst-launch-1.0: xcb_io.c:165: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.

This can be worked around by exporting the variable:
    export GST_GL_XINITTHREADS=1

See for example:
https://bugzilla.gnome.org/show_bug.cgi?id=754198

Those gst-shadertoy scripts are distributed under the 2 clause BSD
license. See the LICENSE file for details.

Julien Olivain <juju@cotds.org>
You can’t perform that action at this time.