Giant spider crabs have gathered in their thousands to moult in a moving mass of shells and pincers in Australia.

The crustaceans, which have characteristically long, spiny legs, have been filmed stretching for hundreds of metres in Port Phillip Bay near Melbourne.

Footage of the giant spider crabs shows them piled 10 deep on top of one another in places, while others move around the edges trying to get closer to the general mass.

Scientists are studying the behaviour to determine the cause, but suspect the crabs are shedding their outer shells as these become too small while seeking safety in numbers during the process.

A spider crab slowly pushes out of her old shell. She will be vulnerable for some time until her new shell hardens (YouTube)

Sheree Marris, an aquatic scientist, said that watching the phenomenon was "spectacular".

"I've seen the aggregation so many times but it never ceases to amaze me," she said.

"This was by far the largest I have ever seen and it's going going to get bigger and better as the crabs are still on the march."

Spider crabs scramble to get out of the way of a ray as it passes through Port Phillip Bay in Melbourne (YouTube/The Nature of Science)

Australia is one of the most biodiverse continents on the planet, with 30 marine mammals and 1,500 species of fish living on the Great Barrier Reef alone.

Spider crabs, which are eaten by larger prey including octupus, larger fish and seagulls, move slowly on their six legs and have long, thin pincers which are not as strong as those of many of their cousins.

They usually gather seaweed and algae to stick to their shells in a bid for camouflage.

But when shedding their old shells and waiting for their new ones to harden, giant spider crabs are relatively vulnerable to predators.

Comedy Wildlife Show all 13 1 /13 Comedy Wildlife Comedy Wildlife Highly Commended (by Julie Hunt) Comedy Wildlife Silver Runner up (by William Richardson) Comedy Wildlife Highly Commended (by Charlie Davidson) Comedy Wildlife Highly Commended (by Alison Buttigieg) Comedy Wildlife Bronze Runner up (by Oli Dreike) Comedy Wildlife Winner (by Julian Rad) Comedy Wildlife Highly Commended (by Mohammed Alnaser) Comedy Wildlife Highly Commended (by Julian Rad) Comedy Wildlife Highly Commended (by Yuzuru Masuda) Comedy Wildlife Highly Commended (by Tony Dilger) Comedy Wildlife Highly Commended (by Megan Lorenz) Comedy Wildlife Highly Commended (by Marc Mol) Comedy Wildlife Highly Commended (by Graham McGeorge)

The video shows many of the creatures on the edge of the gathering scuttling away from a huge sting ray which passes through.