Divers have retrieved the crashed AirAsia plane's second black box from the bottom of the Java Sea, giving investigators the essential tools they need to start piecing together what brought Flight 8501 down.

Senior Transportation Ministry official Tonny Budiono said the trapped cockpit voice recorder was freed from beneath the wing's heavy ruins from a depth of about 30 metres (100ft), a day after the aircraft's flight data recorder was recovered.

It will be flown to the capital Jakarta to be downloaded and analysed with the other box. Since it records in a two-hour loop, all discussions between the captain and co-pilot during the 42-minute journey should be available.

The Airbus A320, which was flying from Surabaya, Indonesia's second-largest city, to Singapore, crashed on December 28, killing all 162 people on board.

"Thank God," Mr Budiono, the ministry's sea navigation director, said. "This is good news for investigators to reveal the cause of the plane crash."

The find is the latest boost in the slow-moving hunt to scour the shallow, murky stretch of ocean.

Over the weekend the tail of the plane was recovered, emblazoned with the carrier's red-and-white cursive logo. The black boxes are housed inside the tail, but were missing when the wreckage was pulled to the surface.

The devices were soon located after three Indonesian ships detected two strong pings being emitted from their beacons, about 20 metres apart. Strong currents, large waves and blinding silt have hindered divers' efforts throughout the 17-day search, but they took advantage of calmer early morning conditions on both days to extract the instruments.

The information pulled from the black boxes - which are actually orange - will probably be vital. Designed to survive extreme heat and pressure, they should provide investigators with a second-by-second timeline of the flight.

The voice recorder captures all conversations between the pilots and with air traffic controllers, as well as any noises heard in the cockpit, including possible alarms or explosions.

The flight data recorder saves information on the position and condition of almost every major part in the plane, including altitude, airspeed, direction, engine thrust, the rate of ascent or descent and what up-or-down angle the plane was pointed.

"There's like 200-plus parameters they record," said aviation expert John Goglia, a former US National Transportation Safety Board member. "It's going to provide us an ocean of material."

In their last contact with air-traffic controllers, the pilots of the AirAsia jet asked to climb from 32,000 to 38,000 feet to avoid threatening clouds, but were denied permission because of heavy air traffic. Four minutes later, the plane dropped off the radar. No distress signal was received.

Searchers also have been trying to locate the main section of the plane's cabin, where many of the victims' bodies are believed to be entombed.

Decomposition is making identification more difficult for desperate families waiting to bury their loved ones. Nearly all passengers and crew were Indonesian.

"I still believe many victims remain trapped there, and we must find them," said General Moeldoko, Indonesia's military chief, who uses one name.