You can debug with gst-launch-1.0 first, and then rewrite the pipeline as source code
Please refer to this FAQ