There are actually 2 "black boxes" which are actually "orange color" in airplanes -
The first one is the Flight Recorder - which makes a recording of numerous flight data, such as airspeed, altitude, rate of climb or descent, heading, G load, bank angle, angle of attack, etc. - The original Flight Recorder were a "black box" among others in the electronic compartment. Then the idea of painting them in orange (or yellow) to make them easy to locate was made, in addition to locate them in the tail of the aircraft, with the idea than the impact of accidents are less likely to destroy the box if located in the tail area -
Later, a CVR "cockpit voice recorder" (second black box that is orange - or yellow) was added in the tail, that one making a copy of radio communications and cockpit conversations, using the pilots microphones and a cockpit area microphone - That CVR normally retains the last 30 minutes of conversations (continuous loop tape) and can be erased by the crew, when the airplane is parked after the flight.
In a 747, the black boxes (orange) are located next (just aft) of the cabin door numbered L-5 at the cabin ceiling level -
.