A school bus driver has been disqualified from driving for two years after a frightening near-miss with a semi-trailer on Sydney's M5 motorway nearly four months ago.

A magistrate in Liverpool Local Court on Wednesday cancelled the licence of Kazem Afkhamisaddoghi, 60, and placed him on a nine-month good behaviour bond. He will need to get a medical clearance if he ever reapplies for his licence.

CCTV footage of the incident showed the school bus carrying 23 children pulling out in front of the semi-trailer in busy peak hour traffic on June 1.

The bus pulled out in front of the truck, which was travelling in the left-hand lane of the M5 at Hammondville.