The Anchorman star will be the latest big-name to descend on the city when the Netflix production Eurovision arrives next week.
Former James Bond Pierce Brosnan and Rachel McAdams, star of Mean Girls and The Notebook, will appear alongside Ferrell in the movie, which is expected to spend a week shooting in the city and involve around 200 extras.
Ferrell, who shot to fame on the American sketch show Saturday Night Live, has co-written the screenplay for Eurovision, which he researched during a visit to the event – staged in Edinburgh in 1972 – in Lisbon last year.
The actor, whose other hits include Elf, Blades of Glory and Daddy’s Home, and McAdams play a pair of aspiring Icelandic musicians “given the opportunity of a lifetime to appear at the world’s biggest song competition.”
Brosnan has been cast as the father of Ferrell’s character, with the former described as “the most handsome man in Iceland.”
Locations in the Old Town and New Town have been lined up for starring roles, along with the historic fishing village of Newhaven, on Edinburgh’s waterfront. It is understood the city will not be standing in for another location in the movie. However it is not known what role Edinburgh will play in the storyline.
News of Eurovision’s forthcoming filming in Edinburgh has emerged days after several weeks of shooting on Fast and Furious 9 wrapped up.
Rosie Ellison, manager of the Film Edinburgh commission, said: “This is a fantastic opportunity for the city to be showcased to millions of both film and Eurovision fans around the world. It allows us to once again demonstrate our film-friendly credentials to the global film industry.”
Cammy Day, depute leader of the city council, added: “It is a source of real pride that Edinburgh attracts these kinds of projects and it’s very exciting to welcome the latest project from Netflix to the city next week. We welcome filming for the economic benefit, employment opportunities and the on-screen promotion it brings.
“Productions are exciting for film fans and we ensure that filmmakers engage with all residents and businesses within the area in which they plan to film, to make sure that life can continue with as little disruption as possible when the city takes centre stage.”
The city had a starring role in last year’s Netflix film Outlaw King, in which Hollywood star Chris Pine played Robert the Bruce. Craigmillar Castle, in the south of the city, was one of the main locations transformed for filming. Edinburgh filmmaker Matt Palmer shot his award-winning 2018 Netflix thriller Calibre in Edinburgh and West Lothian.
Recent comedies shot in Edinburgh include Burke and Hare, which starred Simon Pegg and Andy Serkis, and Festival, which was set at the Fringe.