Automatic rotation

Can you design a function of automation rotation depends on the video itself