They wax nostalgic over old-time pop hits. They break out into song. The song ends up in the movie.

Crystal and Midler say that’s pretty much what happened while shooting their family film, Parental Guidance.

The seasoned comics play grandparents bumbling though a babysitting gig for three rambunctious grandchildren. Between takes, Crystal says, they entertained their young co-stars with a rundown of beloved golden oldies.

“We were shooting in a train station and it was a really good place that had good echo,” Crystal says in a recent phone interview from New York, with Midler alongside him.

“And we just started singing these old time rock ‘n’ roll songs — Charlie Brown, Poison Ivy, Yakety Yak. So we hit on Book of Love and we decided, ‘Let’s put it in the movie.’ And it works really well.”

The spontaneous crooning takes place as Crystal’s easy-going grandpa Artie and Midler’s fun-loving grandma Diane take over their daughter’s technology-laden household for a week.

Marisa Tomei and Tom Everett Scott play the couple’s daughter and son-in-law, a high-strung working couple whose parting instructions include “no sugar” and “never saying ‘No’“ to their three children.

Upon realizing they actually know little about the kids’ interests, Artie and Diane decide to try to bridge the generational gap by introducing some old-fashioned passions like the radio and a game of kick-the-can.

The 64-year-old Crystal says he wanted to make a sweet film the whole family could enjoy.

“Parents can take their parents and grandparents can take their little ones and they can all sit there and not cringe that something bad is going to come up on screen,” says the When Harry Met Sally star.

“That’s a fun thing that you can make a family movie with a lot of integrity and a lot of honesty and a lot of heart, too.”

He says he came up with the premise after babysitting his own granddaughters when they were little.

“They’re nine and six now but this was about five years ago so we had them alone for a week and I was totally exhausted — not only from their amazing energy but by trying to follow the rules that we had to follow,” Crystal says.

“I came in on the seventh day and said, ‘Here’s an idea for a movie.’ We started developing it from there. So for me it’s been almost six years on this one piece and trying to get it made.”

Though the longtime stars have crossed paths many times, they’ve never performed together. Midler says she’s glad to finally get the chance.

“I’ve been a big fan for many, many years and whenever I watch him I’m always amazed at how he gets to do what it is that he does. I mean, just out of thin air just wonderful stuff comes through,” says the Beaches star.

“And when I read the script I was so delighted because stuff crosses your desk that’s not worthy, that gets greenlit all the time, and then here was this little piece that was so funny and they were actually going to make it.”

Neither performer has been seen much on the big screen in recent years, although each has been busy on the stage — Crystal with his Tony-award winning, one-man show 700 Sundays, and Midler with a three-year stint at Caesars Palace in Las Vegas that wrapped in 2010.

Midler says maintaining a film career hasn’t become any easier despite decades in show business, noting that getting a project off the ground is often an exercise in frustration.

“Time goes by so quickly that what you’re able to get done you’re usually so grateful that you got it done because it’s hard. This is a really tough business,” she says.

“It’s an odd business because you have to pass so many hurdles in order to get what it is that you want to have to make and many of them come at the very end. They say, ‘You can’t do this, you can’t wear that, I don’t like your hair, I don’t like your suit, I don’t like your clothes, I don’t like your face.’ I mean it’s endless, endless.”

Crystal jokes that he’s disappointed to be passed over for the lead role in Steven Spielberg’s sober period epic Lincoln, which went to critical darling Daniel Day-Lewis.

“I just thought, ‘If anyone should be Lincoln, I should have been Lincoln,” he jokes.