(Reuters) - Time Warner Inc TWX.N reported a better-than-expected quarterly profit, as revenue from box office hits including "The LEGO Batman Movie," and "Kong: Skull Island" helped offset declining ad sales.

Revenue from the company’s Warner Bros film studio jumped 8.2 percent to $3.37 billion.

Excluding items, Time Warner earned $1.66 per share, beating the average analysts’ estimate of $1.45 per share, according to Thomson Reuters I/B/E/S.

Revenue rose 5.8 percent to $7.74 billion, surpassing analysts’ expectations of $7.67 billion.

Time Warner, which is being bought by AT&T T.N, saw an increase in subscribers in the first quarter at its premium cable channel HBO, making up for a 2 percent decline in ad revenue at its Turner networks. Time Warner said it was on track to close its merger with AT&T before the end of 2017.

The company said it expected total advertising revenue for Turner, which includes CNN and Cartoon Network, to be down again this quarter, a challenge that its peers also face. Comcast Corp CMCSA.O announced a decline in ad revenue when it released first quarter earnings last week.

“Time Warner had a really strong content quarter which is specific to them, but the flip side is that overall trends in television networks look a little soft,” said Doug Creutz, an analyst with Cowen and Co.

Turner chair and chief executive John Martin said he expected a “healthy” upfront season as advertisers have started to commit more in recent weeks.

Like other media companies, Time Warner has been struggling to keep viewers hooked to its channels as they flock to online streaming services such as Netflix Inc NFLX.O and Amazon.com Inc's AMZN.O Prime.

To that end, Time Warner said on its call that it would not offer its library programming on Amazon Prime, opting to keep it for its own online streaming services.

“This is a trend I think we are going to continue to see going forward,” said John Janedis, an analyst with Jefferies Research, noting that other companies like Viacom have started withholding some content from the streaming video providers.

Time Warner’s Home Box Office (HBO) has managed to keep audiences glued to its original shows such as the hugely popular “Game of Thrones.”

Revenue from HBO rose 4.1 percent to $1.57 billion in the first quarter ended March 31.

Shares of Time Warner were up slightly 0.07 percent around $99.28 in morning trading Wednesday.