Warner Communications Inc. and Viacom International Inc. said yesterday that they have reached an agreement that will allow Viacom to acquire Warner's interests in two major cable-television programmers -- MTV Networks Inc. and Showtime/The Movie Channel.

Viacom, the nation's 10th-largest cable system operator, would gain complete ownership of the two programming services and would more than double its annual revenue to about $770 million under the proposed transaction, a spokesman said. Viacom reported profits of $30.6 million on sales of $320 million in 1984.

Under terms of the agreement, Viacom is to pay $500 million in cash and give Warner warrants to acquire Viacom stock, in exchange for Warner's interests in the two programmers.

Warner owns half of Warner Amex Cable Communications Inc., which owns part of MTV Networks and Showtime. Warner said Aug. 9 that it has exercised its option to buy the other half of Warner Amex from American Express Co. for $450 million. The agreement with Viacom enables Warner to finance that acquisition without taking on any debt, said Fred Anschel, an analyst with Dean Witter Reynolds Inc.

Under terms of the agreement, Viacom would acquire Warner's 31 percent stake and Warner Amex's 19 percent stake in Showtime, which offers a variety of entertainment programs and has about 8.5 million subscribers. Viacom, based in New York City, owns the remaining 50 percent.

Viacom would buy Warner Amex's 66 percent share of MTV Networks, which operates two 24-hour music-video stations, MTV and VH-1, and a children's channel, Nickelodeon. MTV reaches 26 million households, VH-1 reaches about 8 million and Nickelodeon reaches about 25 million.

Viacom said it would purchase the remaining 33 percent of MTV Networks' stock, which is publicly owned, for $33.50 a share.

MTV Networks reported a 1984 profit of $11.9 million on revenue of $109.5 million.

Warner would receive warrants to buy 1.625 million shares of Viacom common stock at $70 a share. Warner also plans to buy additional warrants, at $9.75 each, allowing it to acquire another 625,000 shares of Viacom common stock at $75 a share. Viacom closed Friday at $50.50 a share.

If all the warrants were exercised, Warner would own 10 percent of Viacom, said David R. Fluhrer , a Viacom spokesman.

"Viacom's business strategy has long emphasized the importance of developing and acquiring television programming to meet escalating future demand," said Terrence A. Elkes, Viacom's president and chief executive officer. "This transaction . . . will make our company an even more vital force in pay and advertising-supported cable television and will strengthen the competitive atmosphere of our industry."

The transaction "will close as promptly as possible," subject to approval by federal regulatory agencies, the two companies said. Additionally, the sale of Warner Amex's assets currently would be subject to the consent of American Express. If American Express withholds its consent, the transaction will close sometime next year, after Warner completes its purchase of American Express's half of Warner Amex.

The agreement follows the announcement Friday that Warner had rejected a proposal by Forstmann Little & Co. to buy Warner Amex's stake in MTV Networks.

The New York brokerage firm had offered to buy all of MTV's stock for $470 million, or $31 a share, through a leveraged buyout involving MTV management. In a leveraged buyout, a company is acquired largely with borrowed funds that are repaid through operating revenue or through sale of the company's assets.

Forstmann Little raised its bid last week by about $30 million, to $33 a share, but added terms that Warner rejected as unacceptable.