Small FPS while saving video and face detecting

Did you kill the pipeline while running ? For properly saving before closing, sending an EOS may be be required but this is not obvious from opencv.
You may just read read the frame in opencv with appsink and send it to a videoWriter such as here.