LOS ANGELES  “The Hobbit” is almost out of movie jail.

After months of negotiation and delay, Warner Brothers and Metro-Goldwyn-Mayer are on the verge of an agreement that would allow the director Peter Jackson to begin shooting a two-part version of J. R. R. Tolkien’s “Hobbit” early next year.

Barring further hitches  and there have been many, as the studios wrestled with their dual ownership of the project over the last year  a financial deal should be in place over the next few days, according to several people who have been involved in the bargaining. They spoke on the condition of anonymity, citing company policies, confidentiality requirements and the delicate nature of the dealings.

The long-anticipated “Hobbit” films amount to an extension of the hugely lucrative “Lord of the Rings” franchise, which generated about $3 billion in revenue at the worldwide box office and enormous home video revenue for New Line Cinema, now a Warner unit. The films are to be made in 3-D. That is a shift from when the project was conceived. In the dimly remembered recesses of, oh, 2009, people involved with the two-movie version of the Tolkien book, then to be directed by Guillermo del Toro, insisted that 2-D screen technology was just right for a pair of movies that were viewed as being a little more intimate than their sweeping “Lord of the Rings” precursors. Then came “Avatar,” “Alice in Wonderland” and even the much-maligned “Clash of the Titans” one film after another proving that viewers would pay a premium for 3-D.

For MGM, a deal that finally lets the “Hobbit” films proceed would lock in badly needed revenue as the company proceeds with a restructuring that is still far from resolved. For Warner, it means new tent-pole fantasy films just as the company is winding down its long-running “Harry Potter” series. And executives at both companies would be relieved of the building anxiety over delays that had threatened to kill the films, at least for the foreseeable future, if they could not be started by early next year.