This is possible, but not trivial to get right. you can change the gstreamer pipeline to add a filesink. It should look like something like this:
! h264parse
! queue
! "video/x-h264, format=byte-stream"
! filesink location=/home/pi/test.h264
This way it will always write to the same file, overwriting it. And this may not be playable in every player.
There is also this alternative, which packs the video into an mp4 container:
! h264parse
! queue
! mp4mux ! filesink location=/home/pi/test.mp4
Let me know if this works for you.