When a new music video for Jennifer Lopez’s hit “Ain’t Your Mama” ran low on cash due to J.Lo’s “grand” plans, her team had to scramble to broker a last-minute deal to raise more money.

We’re told that a “product-placement specialist” was called in two days before production began on the clip because there were concerns the video — which premiered Friday — couldn’t be completed to the singer’s usual high standards without an injection of extra funds.

J.Lo’s label honchos put together an ambitious shoot in just two weeks to capitalize on the song’s early chart success after Lopez debuted it on the final episode of “American Idol” on April 7. Insiders told Page Six that the Kluger Agency, which arranges deals between brands and artists, got a call at the eleventh hour. To attract additional funding, the team hustled to bring in ­social-networking app Friendable, then reworked the shoot’s script to integrate the product into the storyline.

“Most of these big artists want a really nice visual, and nice is pretty much synonymous with expensive when it comes to product,” said a source. “So a lot of times Jennifer will have this grand idea of what she wants to do, and the label has their budget, and at the end of it, she’ll be short.”

We’re told producers were keen to find something that would fit into the video since it was already packed with more traditional product placements.

In fact, there were so many shoehorned into its five minutes that music site Spin cataloged nine brands in the clip — from Lavazza coffee to ­BodyLab weight-loss supplements.

The “plot” — about women rebelling against outdated domestic roles — culminates with an all-female protest scene in the streets. In the revised version, the lady rabble-rousers use the app to converge. We’re told that, in return, Friendable coughed up the dough to finish off the project with the kind of polish befitting an international superstar. A rep for Lopez declined to comment.

This article originally appeared in the New York Post's Page Six.