YouTube Inc. announced deals to license content from two major record companies just hours before the wildly popular video Web site agreed to be bought by Google Inc. YouTube reached deals with Vivendi’s Universal Music Group and Sony BMG Music Entertainment that will let the Web site post music videos and content from users that includes copyrighted material in exchange for sharing ad revenue.