As an experienced documentarian who turned to feature filmmaking, director Paul Greengrass is comfortable improvising. His free-flowing style was a perfect match for "Captain Phillips," the new fact-based drama about the hijacking of the cargo ship Maersk Alabama and the kidnapping of its captain, Richard Phillips, by Somali pirates in April 2009.

At the Envelope Screening Series, Greengrass' leading man, Tom Hanks, talked about how they improvised the film's final scene. [Spoiler warning: Some plot details follow.]

"We had actually shot another scene that was scripted that was based on what really happened," Hanks said. "It was after everything happened. Phillips was cleaned up, he was in a uniform, he had showered, he was alone for the first time in the captain's quarters and he could have a cold beer, and he had a satellite phone, and there was an emotional crack to it that we shot.… And it was there, and it was fine, and it was right, and we got it."

'Captain Phillips': Watch cast, crew discuss the film

Hanks continued: "We had no reason to think that it wouldn't just be what was needed. But Frank Castellano, who was the actual captain of the [USS] Bainbridge, that rescued Phillips, we asked him, 'So when did you actually meet Rich?' And he said, 'I was busy with the Dept. of Defense and the Navy SEALs, so I didn't meet him until after he came out of the infirmary.' And Paul said, 'Infirmary?'"

"The next thing you know, we're on the way to the opposite end of the ship with everybody on the crew and the cables and the gear and whatnot, to look at this very, very tiny, tiny room.… And Paul says [to the infirmary crew], 'Do you mind if we try to shoot a training exercise, except we'll do it with Tom, and you'll be done up and you'll just do what you would do?' And they said, 'Yeah, we can do it.'"

Greengrass and Hanks spent the next hour filming the post-rescue procedure, "which is 100% exact, authentic, and that was able to allow me just to delve into whatever behavior was going to come out," Hanks said. "Usually those types of scenes in films are on the schedule. You're able to prepare for them. The good news here was that the whole movie was a bit of a preparation for whatever scene that was going to be."

He added, "It ended up just being lightning in a bottle."

For more from the cast and crew of "Captain Phillips," watch the full video above and check back for daily highlights.

ALSO:

Diversity efforts slow to change the face of Oscar voters

'Wolf of Wall Street' at the academy: What really happened

'The Hunt,' 'Grandmaster,' 'Great Beauty' make Oscar foreign shortlist