PENGSHAN, China (AFP) - Thousands of voracious white maggots wiggle frenetically while tearing through trays full of leftover meat, vegetables and fruits in an unusual farm in south-western China.

It may not be a pretty sight, but the gluttonous larvae could help China eat away something far uglier: the country's mountain of food waste.

The individual larvae of black soldier flies, which are native to the Americas, can each eat double their weight of garbage every day, according to experts. The farm in Sichuan province then turns the bugs into a high-protein animal feed and their faeces into an organic fertiliser.

"These bugs are not disgusting! They are for managing food waste. You have to look at this from another angle," said Hu Rong, the manager of the farm near the city of Pengshan.

There's no shortage of grub for the larvae: Each person throws away almost 30 kilos of food per year in China, a nation of 1.4 billion people.

"On average, one kilo of maggots can eat two kilos of rubbish in four hours," Hu said.

Hu buys the discarded food from Chengwei Environment, a company that collects such waste from 2,000 restaurants in the city of Chengdu.

"If you put a fish in there, the only thing that comes out is its white skeleton," Chengwei Environment director Wang Jinhua said.

One third of the food produced in the world for human consumption every year - approximately 1.3 billion tonnes - gets lost or wasted, while some 870 million people are going hungry, according to the UN's Food and Agriculture Organisation.

This waste also exacerbates pollution problems. In a 2011 report, the FAO said that if food waste were a country, it would rank behind only the US and China for greenhouse gas emissions.

Each year, China produces a total of 40 million tonnes of food waste - the equivalent weight of 110 Empire State Buildings.

But there are cultural reasons behind the issue, Wang said.

"When you invite someone to dine at a restaurant, the custom is to always order more dishes than necessary, to show your hospitality. Inevitably, the leftovers are thrown out," he said.

But the black soldier fly, a rather long and slender critter, does more than eliminate waste.

Once fattened, some of the larvae are sold live or dried to feed animals such as chickens, fish, and turtles. They boast a nutritious composition: up to 63 per cent protein and 36 per cent lipids.

The maggots make it possible to recover proteins and fat still present in waste, then return the nutrients into the human food cycle through the livestock.

The larval faeces can even be used as organic fertiliser in agriculture.

China, Canada, Australia, and South Africa are among the countries where it is legal to feed poultry and fish with insects.

"It's more restricted in the United States and in the European Union," said Christophe Derrien, secretary general of the International Platform of Insects for Food and Feed, a non-profit representing Europe's insect production sector.

The EU will allow insect protein as feed in fish farms from July, Derrien said.

"It's an encouraging first step because the EU is opening up to this more and more," he said.

Recycling food waste may offer an economic benefits as well as environmental ones.

Hu makes a comfortable living selling live black soldier fly larvae and fertiliser.

Taking into account costs (electricity, labour, delivery fees, and the price of waste), she makes an annual profit between 200,000 and 300,000 yuan (S$40,343 to S$60,524) - a large sum in China.

It is no wonder, then, that black soldier fly farms have been surfacing all over China since the first sites appeared in the country three years ago.

"This year, we expect to open three or four new sites around Chengdu," Wang said.

"The idea is to transform waste into useful substances."

Leftovers are not the only thing that could get a second life in China.

Chinese energy firm Sinopec plans to build next year a factory in eastern Zhejiang province to turn cooking oil - which is sometimes illegally reused in restaurants - into biofuel for passenger planes.