Hi,
it is a compression time issue. Each RGB frame is compressed as JPG and each depth frame in PNG. See those
lines. On my computer, it is able to record at 30 Hz for resolution 2 (720p) and 3 (VGA). For resolution 1 (1080p), it is more like 15 Hz, then for resolution 0 (2K) it is more like 10-11 Hz.
To record at higher frame rate, use a more powerful computer or you may try recording in a
rosbag instead (in raw format or using an image_transport video encoding).
cheers,
Mathieu