Discovery Communications Inc. (Nasdaq: DISCA) agreed to buy Scripps Networks Interactive Inc. (Nasdaq: SNI) for $11.9 billion in a bet that uniting ownership of cable channels like Animal Planet and HGTV will help the company adapt to the changing television landscape.

Discovery, one of billionaire John Malone’s key holdings, will acquire Scripps for about $90 a share and assume long-term debt of $2.7 billion, bringing the total price of the equity value plus liabilities to $14.6 billion, according to a statement. The price represents a 34 percent premium over Scripps’ closing price of $67.02 on July 18, the day before news of the companies’ talks became known.

Discovery, based in Silver Spring, Maryland, is grappling with shrinking audiences at some U.S. channels — including the Discovery channel and Animal Planet — as consumers drop cable subscriptions and get more entertainment online from Netflix and others. The deal combines two companies that specialize in so-called unscripted programming, focused on real-life adventures, travel, wildlife and home. With Scripps, Discovery gets the home-improvement channel HGTV, where hits like “Property Brothers” and “Fixer Upper” have made it one of the more popular cable networks.

The combined company will have almost 20 percent of the ad-supported pay-TV viewership in the U.S., according to the statement. Buying Scripps could also help Discovery boost its international sales, which currently account for half of its annual revenue. Knoxville, Tennessee-based Scripps owns an interest in Polish TV operator TVN and is expanding HGTV to new countries.

“This agreement with Discovery presents an unmatched opportunity for Scripps to grow its leading lifestyle brands across the world and on new and emerging channels including short-form, direct-to-consumer and streaming platforms,” Scripps CEO Kenneth W. Lowe said in the statement.

Discovery’s offer had forced Viacom Inc. to abandon its own efforts to acquire Scripps, people with direct knowledge of the matter said.

After being left out of some new online TV packages in the U.S., Discovery has been looking to create a low-cost web-only TV service with its cable channels and those of others for consumers who don’t want to pay for sports, people with knowledge of the matter said in April. Neither Discovery or Scripps broadcasts live sports in the U.S.

Though smaller, Scripps has an especially valuable asset in HGTV, which was the fourth-most watched U.S. network in prime time this year, with an average of 1.51 million viewers a night through July 16, according to Nielsen data. Parties to the Scripps Family Agreement control 92 percent of the voting stock.

Deal talk is picking up in the TV industry as network owners grapple with the decline in cable and satellite services amid online competition. Liberty Media’s Malone also has discussed a deal to buy all or part of Spanish-language broadcaster Univision Holdings Inc., according to people familiar with the matter.

Pay-TV distributors like Charter Communications Inc. and AT&T Inc. have grown through acquisitions in recent years, giving them added leverage in fee negotiations with channel owners like Viacom, Discovery and Scripps. That’s led some network owners to conclude they need to sell as well. Time Warner Inc., owner of TNT and HBO, agreed last year to be bought by AT&T for $85.4 billion.

Cable and satellite-TV providers pay fees to channel owners for the right to carry their channels, and the negotiations have grown more tense now that more pay-TV subscribers are cutting the cord.

Network owners are also beginning to offer their own online services to compete with YouTube and Netflix. CBS Corp. offers its flagship network and Showtime as standalone services online. Walt Disney Co., which owns ESPN, is developing an online service to reach sports fans who aren’t using traditional cable.