Comcast Corp. CMCSA -0.70% is in talks to buy DreamWorks Animation SKG Inc. for more than $3 billion, according to people familiar with the matter, in a deal that could make the cable giant a rival to Walt Disney Co. in the lucrative family-entertainment business.

Comcast’s Universal Pictures studio has enjoyed success in recent years with its animated “Despicable Me” and “Minions” movies but is still a relatively small player.

Its parent company, though, has been moving aggressively to mimic Disney by using its animation properties to build out its consumer products and theme parks businesses, a strategy that could be accelerated by the addition of DreamWorks, which makes the “Shrek,” “Kung Fu Panda,” and “Madagascar” movies, among others.

As with all such talks, a deal may not be reached. The tentative purchase price represents a healthy premium over DreamWorks’ current $2.3 billion market value.

Separately on Wednesday, Comcast reported better-than-expected financial results and added video customers again in the first quarter. At NBCUniversal, revenue grew 3.9% to $6.9 billion, as its cable networks and theme parks businesses offset revenue declines at filmed entertainment and broadcast TV.

Class A shares of Comcast, up 13% over the past three months through Tuesday, rose 0.5% to $61.34 in morning trading. DreamWorks Animation shares, up 6.9% over the past three months, jumped 17% to $31.82.

It wasn’t immediately clear what the deal would mean for DreamWorks’ chief executive, the veteran Hollywood mogul Jeffrey Katzenberg. One person with knowledge of the talks said that DreamWorks and Illumination Entertainment, Universal’s animation studio, would remain separate brands.

DreamWorks Animation has several animation properties, including “Kung Fu Panda.” Above, stars Jack Black and Kate Hudson pose at the British premiere last month for “Kung Fu Panda 3.” Photo: Associated Press

Mr. Katzenberg would receive a total payout of about $21.9 million if the company is sold and he leaves DreamWorks, according to the company’s most recent proxy statement. Additionally, he controls about 60% of the company’s common voting stock, according to the proxy.

He has been seeking a buyer for his studio, one of the last in Hollywood not part of a larger conglomerate, for several years.

In 2014, DreamWorks held talks with Japan’s SoftBank Corp. and toy maker Hasbro Inc. More recently it has held discussions with potential buyers in China, said people close to the company.

At the same time, Mr. Katzenberg has told investors in recent years he is working to diversify his company into new businesses such as television, online video, and consumer products, in hopes of stabilizing the inconsistent returns from movie releases.

Several box-office flops between 2012 and 2014 forced the company in early 2015 to lay off 500 employees, close a Northern California operation and cut its feature-film output to two movies a year, from three.

DreamWorks is in the midst of a multiyear deal to produce hundreds of hours of television for Netflix Inc. and has recently enjoyed success with digital video company AwesomenessTV, which it acquired in 2013.

Verizon Communications Inc. this month bought a 24.5% stake in AwesomenessTV that valued the online video studio at $650 million.

Some of DreamWorks Animation’s challenges have come from nimbler new competitors such as Illumination, which rather than building a large studio infrastructure such as DreamWorks’, produces its movies with foreign animators at significantly lower cost.

That has led investors to pressure DreamWorks to lower its costs of production, which typically range between $130 million and $145 million, compared with about $80 million for Illumination.

As brand-name franchises have become the most important markers of success in the movie business, family entertainment has become arguably the industry’s most valuable asset—capable of crossing cultural boundaries at the box office and driving spending on everything from DVDs to toys to vacation destinations.

Since it acquired the NBCUniversal media conglomerate in 2011, Comcast has invested billions in its theme-parks business and built up consumer-products licensing, both of which should allow it to better profit from DreamWorks’ brands and characters than that studio has been able to do independently.

The deal would also give Universal a stronger presence in China, where Mr. Katzenberg has focused much of his energy for the past few years. The CEO travels there at least once a month and opened a joint venture in Shanghai, Oriental DreamWorks, that co-produced the January release “Kung Fu Panda 3.”

DreamWorks Animation movies are marketed and distributed by 21st Century Fox’s Twentieth Century Fox, though that deal will expire in 2017. 21st Century Fox and News Corp, owner of The Wall Street Journal, were until mid-2013 part of the same company.

DreamWorks Animation spun off in 2004 from DreamWorks SKG, an entertainment company founded in 1994 by Mr. Katzenberg and fellow moguls Steven Spielberg and David Geffen.

DreamWorks SKG’s ambitions to become a seventh major Hollywood studio never came to fruition, but its animation division had some early success with hits like “The Prince of Egypt” and “Shrek” before it separated with a public stock offering.

The live-action movie business, run by Mr. Spielberg, has relaunched twice after near-death experiences and recently signed a distribution deal with Universal, meaning an acquisition of the animation company by Comcast would, in a way, bring the two units back together.

DreamWorks Animation shares closed Tuesday at $27.12, down three cents. Comcast stock closed at $61.05, up 5 cents.

Write to Ben Fritz at ben.fritz@wsj.com, Dana Mattioli at dana.mattioli@wsj.com and Erich Schwartzel at erich.schwartzel@wsj.com