It is as thick as your arm, gungy and smells disgusting - and it has just been caught on camera for what is thought to be the first time.

A crew has managed to record a whale shark - the world's biggest fish - expelling food waste, which was then scooped up for research.

Biologist Mark Meekan said the sample had helped him to discover more about the giant creature's feeding habits.

The footage forms part of a BBC Natural World wildlife programme: Whale Shark.

Whale sharks (Rhincodon typus) are related to great whites, but are far less fearsome - they are filter feeders, swimming about with their enormous mouths open to scoop up tasty morsels floating in their paths. One way to work out what is going in one end is to look at what is coming out of the other

Dr Mark Meekan

They can grow up to 12m long; yet, despite their staggering size, very little is known about these ocean giants.

Dr Meekan, who is based at the Darwin office of the Australian Institute of Marine Science, was followed by the Natural World team as he has carried out his research on these mysterious fish.

He said: "It does seem rather weird, someone being so excited about seeing whale shark poo. And I'm pretty certain that this is the first time it has been filmed.

"But it is pretty rare - they are usually doing their business down in much deeper water."

He described the faeces that the team collected as "scientific gold".

"One way to work out what is going in one end is to look at what is coming out of the other. The creatures are the biggest fish in the world

"By seeing one of these animals poo and getting hold of some of that stuff, we can use sophisticated genetic techniques to look at the DNA in that sample to find out exactly what those animals have been eating."

Genetic analysis revealed that the whale shark had been feasting on red crab larvae - and this could be why the fish are attracted to Ningaloo Reef in Australia, which has plenty of this foodstuff available.

Dr Meekan said: "This is something we suspected, but now it has been confirmed.

"It has been really exciting to nail that one."

Dr Meekan and his team have also been using technology to find out more about the fish.

He told the BBC: "The study of whale sharks is a fairly young science. People have only really been studying these things since the late 1980s."

A whale-shark's-eye view of the ocean

But now, he said, advances in tagging technology over the last decade have really helped to improve understanding.

Satellite tags, which relay GPS data every time the fish surface, have already helped researchers to discover the vast distances the creatures travel.

But the team is also now taking advantage of other tagging systems.

Dr Meekan said: "Now we are taking another step forward and instead of just acquiring location, we are now also using tags to look at water temperature and salinity, to make a physical description of the waters they are inhabiting.

"They have also got an accelerometer on board which shows the position of the animal in 3D. It's pretty cool."

The tags also contain video cameras to get a whale-shark's-eye view of its underwater terrain.

The marine biologist said: "There has recently been a rapid evolution of technology. These tags are becoming more and more sophisticated; we are learning more and more things about the animal, its environment and what it is doing.

"We have gone from saying: 'Oh, there the animal is!' to really understanding it, what it is doing out there."