where does the 1272 come from
The minimum fragment size for an IP packet on IPv6 is 1280 bytes. UDP uses 8 bytes for its header, leading 1272 bytes for the payload.
In UDP, the call to recvfrom() will return the exact size of the UDP packet payload (assuming your receive buffer is big enough,) so you don't need to encode that. This is in difference to TCP, which returns "some bytes" when you call recv(), and those bytes may be the end half of one packet and the beginning half of the next, so you need to implement an explicit packet framing protocol.
When you put multiple smaller game messages into a single UDP packet (which you absolutely should do!) then you have to have some way of knowing how many of those messages there are. If each message is fixed size, this is easy. If not, you'll need to encode the length of each sub-message; typically with a byte per message (as almost no individual game messages are > 127 bytes in size, and you can use the leading bit for var-int type encodings.)