The Philippines has started returning dozens of shipping containers full of trash to Canada after a long-running row over waste exports that has tested diplomatic ties amid threats from firebrand President Rodrigo Duterte.

The 69 containers were loaded overnight onto a vessel at the port of Subic, northwest of Manila, and left on Friday for a month-long journey to the Canadian city of Vancouver.

A Philippine court in 2016 declared the import of 2,400 tonnes of Canadian waste illegal. It had been mislabelled as plastics for recycling.

Canada said the waste, exported to the Philippines between 2013 and 2014, was a private commercial transaction done without the government's consent.

"The government of Canada is taking all the necessary measures to ensure safe and environmentally sound transport, handling and disposal of the waste in Canada," Mark Johnson, spokesman for Canada's environment and climate change ministry, said in an email statement.

The Philippines had accused Canada of stalling, prompting angry rebukes from Duterte, a volatile but hugely popular president known for his tirades against Western governments.

He threatened to declare war on Canada, dump the trash in front of its embassy in Manila, or personally sail with the waste and leave it in Canadian waters.

His spokesman, Salvador Panelo, said he hoped ties with Canada would now return to normal.

Philippine Foreign Secretary Teodoro Locsin said diplomats whom he had ordered to leave Canada in protest had now been told to return. Locsin posted a picture on Twitter on Friday of the ship departing Subic, with the message "Baaaaaaaaa bye".

The Philippines is the latest Southeast Asian nation to take issue with developed nations they say use the region as a dumping grounds for waste.

Malaysia, the world's main destination for plastic waste after China, said on Tuesday it would return as much as 3,000 tonnes of waste back to the countries of origin.

Environmental activists gathered in Subic as the containers were being prepared, holding banners that said "never again" and "we are not the world's dump site."

Some carried cardboard boxes made to look like shipping containers bearing signs that read "good riddance" and "Canada take back your trash".

"The waste trade is a very unacceptable practice. It is a deplorable practice," Greenpeace Philippines director Lea Guerrero told reporters.