How are long videos recorded on phones made?

It looks like my camera is set to 1080p at 30 fps.

I don’t have an actual need to shoot long videos. But you never know what might happen.

How do I record directly to iCloud?

You can’t.

I use a smartphone as my primary camera - it’s not expandable, but has 128gb of internal storage - I always used to worry that I might run out, but I can record hours and hours of footage and I don’t think I’ve ever filled it more than halfway.
An hour of 1080p60 is a few gb in size when encoded in h.264. Battery life and CPU heat management are greater limiting factors.