Comcast Corp. has agreed to buy DreamWorks Animation SKG Inc. for about $3.8 billion, reported the Wall Street Journal on Thursday. It was earlier reported that the companies were in merger talks.

DreamWorks Animation's shareholders will get $41 per share in cash, a premium of 27 percent over its share price closed on Wednesday. The shares of DeamWorks which rallied nearly 50 percent in the last six months came to a halt, added Reuters.

With this acquisition, Comcast, the cable giant, will emerge as a rival to Walt Disney Co. in the money-making business of family entertainment, as reported by the WSJ.

DreamWorks Animation, synonymous with movie franchises such as "Shrek," "KungFu Panda" and "Madagascar," was spun off from DreamWorks Studios in 2004. The studio was founded in 1994 by Steven Spielberg, David Geffen and Jeffrey Katzenberg, said the news agency.

DreamWorks will operate under Comcast's NBCUniversal in its Universal Filmed Entertainment Group that includes Universal Picture that produced recent successful flicks like "Despicable Me" and "Minions." However, it's still a relatively small player in the family entertainment business, said the WSJ.

The deal will also add DreamWorks' classic media library, including "Where's Waldo," "Casper," "Lassie," and "Rudolph The Red-Nosed Reindeer" to NBCUniversal's portfolio

The new entity to be called DreamWorks New Media will be chaired by Katzenberg, the co-founder CEO of Dreamworks, with its other portfolio businesses such as the 2013 acquired Awesomeness TV and NOVA, said reports.

DreamWorks witnessed many box-office flops between 2012 and 2014, forcing the company to lay off 500 of its North American staff, and cut down on its annual releases to two. Katzenberg, it was reported, also sought an exit from the animation studio, holding talks with certain Chinese companies until recently.