How do I use avfoundation to take live photo with different aspect ratios as 1:1, 16:9

Hi guys, I'm designing a customized camera based on avfoundation. I can output Live Photo from avCaptureDeviceInput for now. I expect to take still and live Photos with different aspect ratio, just like the apple's camera app does (1:1, 4:3, 16:9).

I didn't find any useful infos from docs, any suggestion?