GStreamer for recording live video

Hi everyone,

Ive made a sketch witch decodes a full HD h.264 camera livestream, displays it and puts a overlay on it.
To this point everything works fine and fast using the P2D renderer.

Now i need to record this video, preferably also with h.264.
Ive already tried the external ffmpeg solution by hamoid:

But this solution is very slow and not usable for live video.

Now my thought is on GStreamer. I understand that it is possible to use it to do exactly what i need although not knowing if it is fast enough.
I already use GStreamer in my sketch with the video library and a latency modification provided by neilcsmith:

It works very fast and nice.

And now my problem:
I dont know exactly how to start or how to do it.
I had a look into the gstreama-java google group:
https://groups.google.com/g/gstreamer-java
But honestly, i didnt understand much. Does anyone have a tutorial or a description?

Kind regards,
StainlessHolz