Mocap walking loop cleanup

I’m new to Blender animation. I mainly work with unreal and recently got into motion capture. I’m trying to clean up one of my walking captures but cant seem to get a glitch out of the walking loop at the beginning and end. I’ve been messing with it for several days but cant get it just right. Any tips on how to make this loop more smooth so that it doesn’t glitch every time the loop resets?

This is probably a stupid question but are there any tips on how to get the feet to recognize they’re walking on an actual floor? I saw a video last night on youtube from Royal Skies where he created a custom driver that would tell the feet there is a floor and how to bend as it comes in contact with it. The problem is he’s using a custom skeletal system and im using the Unreal Engine skeletal system.

Thanks in advance for your help and any tips or tricks you might have.

I tried to upload a short clip of the walking animation loop but im a new user and it wont let me.

NLA / Action Editor

Retarget to a custom rig

Walk Cycle

Rigs (UE4/Unity/Godot)