If you don’t want to debayer, you may use V4L API:
# Install package v4l-utils if not yet done, it provides v4l2-ctl command
sudo apt install v4l-utils
# Check available modes for your camera (assuming first camera on /dev/video0)
v4l2-ctl -d /dev/video0 --list-formats-ext
# Capture 100 frames (you would adapt to your sensor modes) to file
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100 --stream-to=test_100frames.RG10
You may have to set framerate, gain and exposure.
That being said, decoding the file may not be obvious. You may have to know how pixels values are stored.
About debayering with gstreamer, this would only work with bayer8 or bayer16. Non byte-aligned sizes are not supported, AFAIK.