Production of Avengers: Infinity War and Avengers: Endgame

Avengers: Infinity War and Avengers: Endgame are American superhero films based on the Marvel Comics superhero team the Avengers, produced by Marvel Studios and distributed by Walt Disney Studios Motion Pictures. They are the sequels to The Avengers (2012) and Avengers: Age of Ultron (2015), and respectively serve as the 19th and 22nd films of the Marvel Cinematic Universe (MCU). Both films were directed by Anthony and Joe Russo from screenplays by the writing team of Christopher Markus and Stephen McFeely. They feature an ensemble cast composed of many previous MCU actors, headlined by Robert Downey Jr., Chris Hemsworth, Mark Ruffalo, Chris Evans, Scarlett Johansson, Don Cheadle, Karen Gillan, Bradley Cooper, Gwyneth Paltrow, and Josh Brolin. In Infinity War, the Avengers and the Guardians of the Galaxy fail to prevent Thanos from collecting the six all-powerful Infinity Stones and he uses them to kill half of all life in the universe. In Endgame, the surviving Avengers and their allies attempt to reverse Thanos's actions.

Development of Infinity War and Endgame began with Marvel Studios' early films, which introduced the Infinity Stones as plot devices and teased a future storyline with Thanos as the villain. Downey Jr. signed on in June 2013 to reprise his role as Tony Stark / Iron Man in the films, Brolin was cast as Thanos the next May, and many other actors were confirmed to be appearing in the following years. The films were officially announced in October 2014 as Avengers: Infinity War – Part 1 and Part 2. The Russo brothers and Markus and McFeely joined the project in early 2015. In July 2016, the first part of the film was shortened as Avengers: Infinity War, while the second became Avengers: Endgame in December 2018. The films were renamed because they were intended to tell two different stories. They were designed to conclude the "Infinity Saga" storyline that had been told throughout all MCU films up to that point, including ending the character arcs of Stark and Evans's Steve Rogers / Captain America.

Both films were shot back-to-back at Pinewood Atlanta Studios in Fayette County, Georgia. Production on Infinity War took place from January 23 to July 14, 2017, with additional filming in Scotland, the Downtown Atlanta area, and New York City. Filming for Endgame took place from August 10 to January 11, 2018, with additional filming in the Downtown and Metro Atlanta areas, the state of New York, Scotland, and England. Final reshoots for Endgame were held in January 2019. The films were the first Hollywood productions to be shot entirely in digital IMAX, using a new camera developed with Arri. Jeffrey Ford and Matthew Schmidt edited both films, and Alan Silvestri returned from The Avengers to compose the musical score. Visual effects companies that worked on both films include Industrial Light & Magic, Framestore, Weta Digital, DNEG, Cinesite, Digital Domain, Rise, Lola VFX, and Perception. Prominent visual effects include the digital characters Thanos and Hulk with new performance capture technology as well as multiple digital de-aging sequences.

Avengers: Infinity War was released on April 27, 2018, and Avengers: Endgame was released on April 26, 2019, both part of Phase Three of the MCU.

Background
Throughout their early films in the Marvel Cinematic Universe (MCU), Marvel Studios began preparing for an adaptation of Jim Starlin's 1991 "The Infinity Gauntlet" comic by introducing the Infinity Stones as MacGuffins: the Space Stone as the Tesseract in Captain America: The First Avenger (2011); the Mind Stone inside Loki's scepter in The Avengers (2012); the Reality Stone as the Aether in Thor: The Dark World (2013); the Power Stone within the Orb in Guardians of the Galaxy (2014); and the Time Stone within the Eye of Agamotto in Doctor Strange (2016). According to James Gunn, writer and director of the Guardians of the Galaxy films, Marvel decided that the Aether and previous MacGuffins would be used as Infinity Stones during production on The Dark World (these MacGuffins and the Infinity Stones are separate objects in the comic books). Before that decision was made, the Orb was intended to be presented as having red energy in the first Guardians film and had to be changed to purple in post-production to give each of the Infinity Stones its own color, since the Aether was also red. Gunn did not know the importance of the Stones to the wider MCU when he created their backstory, without much thinking, for the Guardians of the Galaxy scene where Taneleer Tivan / The Collector explains the origins of the Stones.

Thanos, a villain who covets the Infinity Stones, was introduced to the MCU in a brief appearance at the end of The Avengers. Many fans subsequently expected Thanos to be the antagonist of the sequel, Avengers: Age of Ultron (2015). However, Joss Whedon, who wrote and directed the first two Avengers films, explained that the character would not be the primary antagonist until a later film because he is "so powerful, he is not someone you can just try to out punch. Like in the comics, you want him to be threading through the universe and to save the big finale for the big finale". Thanos appears at the end of Age of Ultron in another brief appearance, this time shown to have the Infinity Gauntlet, a glove designed to house the Stones. A different Infinity Gauntlet was previously shown in Odin's vault on Asgard in Thor (2011), but following the Age of Ultron scene this first Gauntlet was revealed to be a fake in Thor: Ragnarok (2017). President of Marvel Studios Kevin Feige explained that the first Gauntlet was included as a small Easter egg in Thor before an adaptation of The Infinity Gauntlet was in active development, and once Marvel had begun planning that storyline they realized that it would not make sense for the Asgardians to have the Gauntlet. Marvel's internal explanation was that the first Gauntlet was a fake, and Ragnarok was able to address this onscreen. The Age of Ultron Gauntlet is also considered fake, with writers Christopher Markus and Stephen McFeely saying it was a "fashionable practice Gauntlet".

Announcement
In July 2014, Feige said there were "some notions" to where Marvel would want to take a third Avengers film and the studio was aiming for three years between Age of Ultron in 2015 and a sequel. In October 2014, Marvel announced a two-part sequel to Age of Ultron titled Avengers: Infinity War. Part 1 was scheduled to be released on May 4, 2018, and Part 2 was scheduled for May 3, 2019. Marvel's plan was to film both parts of Infinity War back-to-back. In January 2015, Whedon said it was "very doubtful" that he would be involved with the two films, and rumors spread that the making of Age of Ultron had been difficult for Whedon. Marvel did approach him about writing the next films, and Whedon did not rule out contributing to the screenplays in some way, but he declined to sign on as the main writer and he felt Marvel knew that any contribution from him would not be able to happen soon. Whedon later cited the series' "increasingly enormous" scale as the reason he chose not to return, explaining that he would not be able to give Infinity War "what I would need to".

Anthony and Joe Russo reached a deal by April 2015 to direct both parts of Avengers: Infinity War, after directing Captain America: The Winter Soldier (2014) and Captain America: Civil War (2016) for Marvel. A month later, Markus and McFeely had signed on to also return from the Captain America films, writing the screenplays for both parts of Infinity War. McFeely later recalled that the pair had started negotiating to write the two films without ever actually being asked to do so by Feige or Marvel. Anthony Russo described the two Avengers sequels as the culmination of all the MCU films since Iron Man (2008), bringing an end to some things and beginning others. Marvel called this overall storyline "The Infinity Saga", comprising Phases One, Two, and Three of the MCU. In April 2016, Jon Favreau said he would executive produce the films after doing the same for the previous Avengers films and also directing the first two Iron Man films. Gunn also served as executive producer on the films, working with the Russos, Marvel, and Feige to ensure the Guardians of the Galaxy characters were "well taken care of" in the films. In March 2018, Disney moved the first film's United States release to April 27, 2018, so it would be released on the same weekend in the U.S. as in several international markets. That December, the release of the second film was changed to April 26, 2019.

Titles
After announcing the films as Avengers: Infinity War – Part 1 and Part 2, Feige said these were titled as two parts of a single film because of the shared elements between them, but he felt they would be "two distinct" projects, not one story split across two films. Anthony Russo reiterated this, saying the two films were "very very different from one another. It's not a part one and part two scenario, necessarily. They're just two different expressions. I think it creates a misconception that we're shooting them at the same time". The Russos decided in May 2016 to retitle the two films to remove this misconception; That July, Marvel shortened the first to Avengers: Infinity War and left the second as untitled.

Anthony Russo said second title would not be revealed "for quite some time", with Feige and the Russo brothers indicating that it was being withheld to avoid giving away plot details for the films. In April 2018, Feige said Marvel chose to withhold the second film's title for so long because they did not want to take the focus away from Infinity War, which had happened to Age of Ultron when the next two films were announced before that one had been released. Feige now felt this approach had backfired due to speculation about the untitled film's title getting "entirely out of hand" and generating high expectations which the actual title would not be able to live up to. That December, with the release of the untitled film's first trailer, the title was revealed to be Avengers: Endgame. The film was previously referred to internally as Avengers: Infinity Gauntlet, which star Zoe Saldaña had accidentally revealed in 2017.

Process
When they were hired to write the films, Markus and McFeely were told by Feige and Marvel to make two separate films rather than a two-part story. They were also asked to use Thanos and the Infinity Stones, which suggested to Markus that the Guardians of the Galaxy should likely be included in the films. They were allowed to use any characters from throughout the MCU, and could kill-off characters if they wanted to. During the filming of Civil War in 2015, they started reading comic books and writing down ideas for what could happen in the films. They ended up with 60 pages worth of unrelated ideas which Marvel went through and either highlighted or flagged as not possible. Additionally, they created a master document in which they explored numerous possibilities for the direction of the story, comparing it to the What If comic book series. For the last four months of the year, the pair spent most of their time in a conference room with executive producer Trinh Tran—the representative from the "Marvel Studios Parliament" for the Avengers films—as well as Feige and the Russo brothers whenever they were free. Marvel gave them baseball cards of all the MCU characters so far, and each noted whether the respective actor was available for the films. The writers began to pick potential groupings of characters, and gave these to Marvel along with their pages of ideas. McFeely referred to this stage of the process as research and development, with the pair attempting to figure out what elements Marvel and the Russos wanted to include in the films. As they came up with ideas for moments or scenes, such as when Thanos uses all of the Infinity Stones, these were written on cards and placed on a timeline to allow the writers to work towards those beats. Once this was completed, Markus and McFeely compiled the cards into an initial outline that included moments, scenes, dialogue, and jokes. They re-wrote the outline to be more readable, and sent it to Marvel for approval.

The writers began work on the actual screenplays in January 2016. Each week they took several scenes from the initial outline (there were around 80–90), assigned them a page count, and began writing them individually. They combined their work at the end of the week and repeated this until they had a "Frankenstein Draft" that McFeely described as long and repetitive but with some "gold" in it. They worked together to re-work these into a functional first draft. Completed first drafts for both films were handed to Marvel on May 1, 2016. While the films were in pre-production the pair continued to write new drafts, and were working on the third draft of Infinity War and the second of Endgame by July. Though they were working on both films at the same time, they only worked on one film each day. In October, Ragnarok screenwriter Eric Pearson was flown from Ragnarok set in Australia to Atlanta where the Avengers films were being prepped so he could assist Markus and McFeely, who were "just so crammed for time". Pearson said the pair were comfortable allowing him to work on one film while they focused on the other due to his previous Marvel writing credits, including working with them on the MCU television series Agent Carter (2015–2016). Markus and McFeely later estimated that they had written at least five or six drafts of each film by the end of 2016. During that year, they received notes on the drafts and came up with new ideas themselves which Markus described as "winnowing down and really focusing on what these movies are about".

The Russos and the writers worked with all of the other Phase Three filmmakers to keep continuity, talking "on an almost weekly basis". Doctor Strange director Scott Derrickson was "kept in the loop" on how Stephen Strange was being used through his close relationships with Feige and Joe Russo. Derrickson also gave general advice on the plot of both Avengers films to Joe. Gunn wanted to ensure that the Guardians were "as funny as they should be and as honest and truthful as they should be". According to Markus, Gunn came up with at least one "hysterical" joke for the Guardians and also chose "The Rubberband Man" by The Spinners as their opening song in Infinity War. Gunn provided insight to a choice made by Markus and McFeely for Peter Quill / Star-Lord that both Gunn and actor Chris Pratt felt was not true to the character. His suggestion did not alter the overall story, and McFeely felt it was a good example of how working with the other MCU filmmakers was a bonus for these films. Gunn also suggested they include a kiss between Star-Lord and Gamora; he cut one from Guardians of the Galaxy Vol. 2 (2017) because it would have happened at a "weird time" in that film but he still wanted to cement the pair as a couple. The Russos did make some decisions that Gunn felt were disconnected from how he wrote the Guardians in his films, and he particularly dismissed Star-Lord's vengeful rage towards Thanos at the end of Infinity War upon realizing Gamora's fate as a choice he would not have made. Some of the biggest rewrites to the script involved Thor, since Markus and McFeely originally intended him to be the "straight man" to the Guardians. His scenes had to be revamped after star Chris Hemsworth explained the more comedic direction the character was taken in Ragnarok. That film's director Taika Waititi was brought in to consult with Markus and McFeely on the new tone of Thor's character, while Pearson's involvement aided in keeping this continuity.

After the beginning of principal photography on Infinity War in January 2017, the writing process became what Markus described as "particle-ized", with multiple drafts of a single scene being written at one time between the writers and directors. Members of all the films' departments also started providing more input to screenplay revisions. On set, the writers attended rehearsals with the actors each day so they could respond to any issues with the scenes straight away, and also to provide alternative jokes for the actors to say during filming. Once filming began, they would return to revising the scenes that had not yet been filmed. They also coordinated with the editing team in an effort to make any rewrites as fast as possible based on footage that the editors received. This was done with the hope of being able to reshoot scenes while the actors were available and the sets still existed, where possible. The duo had not finished writing the final script for Endgame by the time Infinity War had been released and had continued editing the script for minor things, which Markus described as being "connective tissue where this scene makes sense, and this makes sense, but not together". The last writing the pair did for Endgame was for additional photography that took place in January 2019.

Story
Feige said all non-Avengers films in the MCU were setting-up for this storyline, with Black Panther (2018) and Ragnarok being particularly important links. The Russos wanted "a strong through line" from The Winter Soldier to Civil War and into the two Avengers films, saying, "We look at [Civil War] as setting the stage for Infinity War, how it starts and what condition everybody's in". The brothers wanted to approach the cosmic elements of Infinity War with the same fervor that they gave to the more grounded films Winter Soldier and Civil War. Though they were unable to depict the films with naturalism given their science fiction content, they did want their films to have a psychological realism. Anthony added that Infinity War would deal with "themes of fate and destiny and the essence of what it means to be a hero". Feige said the films would explore whether the visions the Avengers had in Age of Ultron were predictions of the future or just projections of their fears. Anthony said the films melded the tones of the individual MCU franchises, and would be tonally different from each other.

Infinity War is set approximately two years after the events of Civil War, as the Russos always set "everything based on when the last movie came out". In addition to Starlin's "Infinity Gauntlet", Markus and McFeely drew inspiration from Jonathan Hickman's "Infinity" (2013) comic. Infinity War was crafted like a 1990s heist film, with the brothers looking at many films "that had that heist-style energy to them", as Infinity War "has that energy of the bad guy being one step ahead of the heroes", with Thanos "on a smash-and-grab" to acquire all of the Infinity Stones. The films 2 Days in the Valley (1996) and Out of Sight (1998) served as inspiration for the brothers.

Beyond the script used in the final film, two different drafts of Infinity War were also created. One of these drafts featured Thanos as the film's narrator, utilized a non-linear structure, and also had backstories for the "Children of Thanos". Though this draft was not used, writing out Thanos's narration helped give Markus, McFeely, and the Russos more insight into the character. The other draft began the film after Thanos had already acquired the Space Stone, but this was rejected because "it felt like he had too many Infinity Stones to start". Going with the draft used in the final film, the plot had been "simplified, made more linear, and allowed more of the character moments [to] come through" as the start of filming approached, giving the Russos "a very tight script" to work with. Unlike Infinity War, Endgame features mainly an original story that does not draw inspiration from any existing comics. Joe Russo explained, "I think we're in pretty fresh territory with [the film]. If anything, I think it's interesting after to go back and look at some of the Marvel films and view them through a different lens. But I can't think of any comics in particular that would have value" to give a basis for the film's story. Joe Russo also described the second film as "more of an epic adventure in the classic sense, with huge emotional stakes".

While Infinity War features one post-credits scene, as with previous MCU films, the Russos considered not including one. Anthony noted that part of the reason for considering this "was because we knew the ending was a complicated ending, a difficult ending, and we wanted that ending to be very definitive. We didn't want to complicate it with other ideas". He felt the tag used, which shows Nick Fury signaling for Carol Danvers / Captain Marvel before dusting away, put "a small button [on the ending] but that's it". Regarding the ending of Infinity War with Thanos wiping out half the universe, Markus stated, that stopping before he snapped his fingers or without all of the Stones would have been like hitting a pause button, so they wanted to everything definitive. The scene where Hawkeye's family disappears following Thanos's "snap" was originally written for the end of Infinity War as a way to show that Thanos's actions were affecting more than just the battle field. However, they found that it did not work for the pacing of the film because it forcibly changed the tone during the film's climax. The Russo brothers suggested putting the scene at the start of Endgame, and the writers felt this was a good move because it reinforces the feelings that the audience had at the end of Infinity War before continuing the story.

Markus and McFeely spent weeks trying to figure out how the Avengers could defeat Thanos, eventually realizing the importance of Ant-Man and the Wasp (2018), despite the film not having a script when they began writing Infinity War and Endgame, due to Lang ending the film trapped in the Quantum Realm, with McFeely calling it a "big aha moment". The duo also had to close the 11 year story for Tony Stark, calling Stark reconciling with his father the "last piece of unfinished emotional business" in his life. Downey improvised the line of Stark calling Rogers a liar in their first face to face meeting after he and Nebula are brought back to Earth by Danvers. According to Anthony Russo, Downey put a lot of energy into the scene as a whole, which made the Russos not want to do many takes of the scene because he was expending himself so much.

The five-year time jump was inspired by the What If comics. The idea of what ifs inspired the storylines of each of the original Avengers, including Stark getting married and settling down, Banner and Hulk merging, and Thor becoming a fat drunk. However, McFeely points out "[t]hat was the idea to do that, but not as What If – keep the stakes. That all happened, it's all part of canon." Markus and McFeely also felt that Stark had to die because it legitimizes everything, saying that people will think less of everything that came before because "if you just keep going until it peters out or you lose interest, it kind of decays backwards". One of the earlier versions of the script featured Thor fighting against himself on Asgard. The Russos felt this scenario became too complicated and preferred to keep Captain America fighting himself. They wanted to make sure that any story they included "had enough time to impact the audience" although they pointed out the Thor showdown would have shown his growth over the previous decade. They ultimately deferred to the storyline with his mother as it "was more part of Thor's journey and repair than confronting his former self".

For the time travel scenes, theoretical physicist Clifford Johnson was consulted, although he was not allowed to see the script. He gave the Russo brothers knowledge of various time travel scenarios and then sat back to let them decide which worked best for the story they were telling. The Russos felt that recreating sequences from other films was the biggest challenge of the time travel scenes including Quill dancing on Morag, which was a mix of footage from Guardians of the Galaxy and freshly shot footage. They learned around three years before the release of Endgame that Downey and Evans would be done with their respective roles after Endgame. With that information, when it was time to come up with the story of the film, the ending was worked on first as they felt that they had to know where the film was going in order to tell the best story because "It’s how you maximize the drama and character architecture" according to Joe Russo.

Character selection
The writers did not initially worry about actor availability and just used the characters how they wanted. They adjusted the scripts later based on scheduling constraints. Joe Russo felt the audience would not be disappointed in the number of characters in the films, saying that "like 67 characters" who were previously introduced in the MCU had been placed out on a board for consideration. Because of the number of characters, McFeely called writing Civil War "a walk in the park" compared to these films. Joe explained that they intended to focus on a "handful" of characters and build the story around their emotional arcs, with many of the other characters having ancillary roles. He also said that the number of characters in Civil War prepared the brothers to "deal with probably triple the amount of characters in Infinity War", and that the characters given main focus would shift between the two films. Gunn said the Guardians of the Galaxy's roles in the films would not be the biggest part of the film, but would be integral due to their connection to Thanos.

Acknowledging that there are 23 characters on the Infinity War poster, McFeely said there was an early decision to not have "scene after scene [with] 23 people in a room moving from plot point to plot point", which would mean many popular actors and characters would have nothing to do in each scene. Instead, the writers divided the characters into smaller groups so each scene could be valuable for all the characters present. Those groups were weaved together as required by the story. Anthony Russo compared Infinity War character groupings to "Nashville (1975) for super heroes. It's storytelling that is vignetted storytelling." The groupings included: Tony Stark / Iron Man, Dr. Stephen Strange, Peter Quill / Star-Lord, Peter Parker / Spider-Man, and initially Bruce Banner / Hulk, and Wong; Thor and the Guardians of the Galaxy, with Thor, Rocket, and Groot ultimately splitting off on their own; Wanda Maximoff and Vision; Thanos and Gamora; and Steve Rogers / Captain America, Natasha Romanoff / Black Widow, Sam Wilson / Falcon, Bucky Barnes / Winter Soldier, Banner, and T'Challa / Black Panther. Markus said many discussions on character pairings were about whether to pursue and further develop pre-existing relationships or to introduce new ones, with him feeling that new pairings had the emotional level of a first date while taking characters that had been together before and putting them "in a much more dire situation" allowed them to "really get down into the meat of their relationship".

Actor Robert Downey Jr. said in Stark's grouping there was a desire "to keep a little bit of the Science Bros [Stark/Banner relationship] alive" and to expand on the positive Stark/Parker relationship from the previous films. McFeely explained that the pairing of Strange and Stark came together because of the similarities between the characters being "guys with a vision but also an ego". To differentiate between the two, Markus and McFeely contrasted Stark's established story arc and drive to confront Thanos with Strange's more reluctant stance. They added that Quill provided "color" due to his arrogance. A Sherlock Holmes joke was avoided when Strange first meets Stark, as the Russos felt it was a "meta joke that requires you to be a fan of other movies"; Downey portrayed Holmes in the films Sherlock Holmes (2009) and Sherlock Holmes: A Game of Shadows (2011) while Cumberbatch portrayed the character in the television series Sherlock (2010–2017). McFeely described Thor's teaming with Rocket and Groot as "delightful". Markus added that Rocket was considered for many other pairs, but ultimately landed with Thor because they felt the group dynamic "brings out new things in Rocket that you wouldn't have expected" as they felt people might have initially perceived Rocket as not being capable to help Thor with much. Rogers's group continues from the events of Civil War, showing he, Romanoff, and Wilson have been on the run, in part by their different appearances (Rogers with a beard and Romanoff with blond hair). The writers did not dwell on the romance between Romanoff and Banner, as established in Age of Ultron, beyond including a "loaded look between the two" because they considering it unrealistic as they would be more focused with Thanos; Maximoff and Vision's relationship was implied to have further developed since the events of Civil War.

Markus and McFeely had originally killed off the villain Red Skull in The First Avenger but changed this ending to the character vanishing to an unknown location after holding the Tesseract. Due to the character's history with the Infinity Stones, they decided that he could be the voice of expertise when Thanos and Gamora arrive on Vormir to retrieve the Soul Stone. The writers felt this reveal would surprise the audience while pushing the plot forward. The Russos also revealed that, despite not appearing in Infinity War, the events of the film killed Betty Ross and Sif, previously portrayed in the MCU by Liv Tyler and Jaimie Alexander, respectively. Gunn was informed in advance about the decision to kill Gamora off in Infinity War; he had considered killing her off in Vol. 2 before discussing it with Marvel and agreeing that she should die in Infinity War instead. Markus and McFeely made use of time travel as a plot device to bring Gamora back in Endgame so that Gunn could use her in Guardians of the Galaxy Vol. 3 (2023). Hope van Dyne / Wasp and Danvers both only appear in Endgame, in order to preserve their debuts in Ant-Man and the Wasp and Captain Marvel (2019), respectively, which were released between Infinity War and Endgame. Other characters, such as Clint Barton / Hawkeye and Scott Lang / Ant-Man, were excluded in Infinity War for "a very specific story choice". Joe Russo said "we have a really interesting story cooked up for both of those characters, and part of that story required that they be under house arrest [in Infinity War]." Because Captain Marvel had not been made when Markus and McFeely began writing the films, they "didn't have much to go on" for Danvers. They wanted her to have more than a cameo appearance but because of how powerful she is they were careful to not have her take over Endgame. McFeely said that would not have been fair to the original Avengers as the intention of Endgame was to farewell those characters. Likewise with Infinity War, McFeely said Black Panther was not a main character in the film despite fan expectations following the success of his own film earlier in 2018.

After announcing the films, Feige said there was a possibility that characters from Marvel Television's MCU series could appear in the team up, and actors such as Krysten Ritter, who played Jessica Jones in the Netflix series of the same name, expressed interest in this. Anthony Russo stated that this would be "complicated" due to the television series' serial nature of storytelling and the fact that Marvel Studios and Marvel Television have separate oversight. Markus and McFeely talked about possibly including Daredevil or Luke Cage during the scenes set in New York City, but they felt that including them for quick cameos would not have satisfied the audiences. The brothers later said that "the briefest consideration" to including television characters was made, but it was "practically impossible". Joe added, "Our job is to focus on the Marvel film world and offer a satisfying climax". Marvel Studios' executive Brad Winderbaum acknowledged that while Marvel Studios and Marvel Television were in communication with each other and Marvel Television series included easily integrated references to the films, trying to include references to the television series in Infinity War and Endgame "was just too much for us to wrap our minds around at the time".

After Starlin expressed dissatisfaction with his pay from Disney for the use of Thanos, Gamora, and Drax—all characters that Starlin created for the comics—in the Guardians of the Galaxy films, he was able to negotiate higher payments for Thanos's appearances in Infinity War and Endgame. Starlin noted that the agreements allow for comic creators to be paid higher amounts, but this only happens when those creators make public complaints.

Character arcs
While working on Civil War, Markus and McFeely realized that the trajectory of the main character arcs was leading to Rogers eventually retiring from being a hero, and Stark eventually sacrificing his life to save the world. Since around October 2015, the pair knew that Endgame would therefore end with the death of Stark. The funeral scene was inspired by large splash pages in comic books where numerous heroes are depicted at a funeral following the death of a fellow hero, and was described by Markus as a "tour" through the MCU and all its characters while saying goodbye to the character that started the franchise. The scene was labelled "The Wedding" for production to avoid spoilers. Because they felt that a somber funeral did not suit the character of Stark, the writers decided to have him give his own eulogy as a way to include the character's voice and humor in the ending. This was set up by showing Stark recording a message at the start of Endgame when he first thinks that he is going to die. In response to the events of Ragnarok and the changes that film made to Thor's character, it seemed natural to the writers for him to become depressed after Infinity War as he tries to deal with all he has lost. The writers felt that the version of Thor seen in Endgame fit the comedic tone established in Ragnarok while also revealing the deeper pain of the character in a dramatic way. Romanoff helped to hold survivors together after the Blip, but ultimately sacrificed herself in order to get the Soul Stone. Joe Russo adds that in Infinity War, the Avengers say that they do not trade lives, with the desire to protect people, while in Endgame "there’s now a desire to sacrifice in order to accomplish the goal". Russo added that both Romanoff and Barton had the same mission in the moment, but Romanoff's focus was on Barton not sacrificing himself in the hopes that the Blip could be reverse to allow Barton to reunite with his family, while he had mixed agendas which took the edge off of his focus in a way that did not happen for Romanoff.

Markus described writing Thanos as "delightful" and a "breath of fresh air", with McFeely explaining that Thanos always controls the scenes he is in, so when they put him in a situation where he is out of control it created a lot of drama. Discussing how they handled the character, who the audience knows is the threat of the films but has so far had little scenes and screen time to divulge his history and motivations, Markus said, "We don't get an element of surprise [with his introduction]... You can count on a lot of scenes where we illuminate a lot about him very early [in the first film]", with McFeely adding, "It is incumbent upon us to give him a real story, real stakes, real personality, and a real point of view". The writers avoided the comic book storyline where Thanos tries to woo the female manifestation of Death, and instead paired him at times with Gamora, since "they had a lot of history we wanted to explore" and would add layers to Thanos that would avoid him becoming a simplistic antagonist who "wants ultimate power just to take over the world and sit on a throne". The Russos felt that the necessary time to introduce Death would be better spent on Thanos and the film's already large cast, with Anthony Russo expressing his conviction that adding a character whom the audience did not know about and having to explain her backstory with Thanos so the audience would care about her and find her interesting did not help to carry forward the story as it had been set out. Avoiding the Death storyline moved away from the tease Whedon used in The Avengers with the character, where Thanos felt that by challenging the Avengers, he was courting death. Though the tease was purposely ambiguous, Whedon felt when he featured Thanos he did not know what to do with him and "kind of hung [Thanos] out to dry". Whedon admitted that while he enjoyed Thanos' character and his "love affair with death", he did not understand the character. Whedon enjoyed the approach the writers and Russos took in Infinity War, giving Thanos "an actual perspective and [making] him feel righteous to himself", since the Death storyline was "not a concept that will necessarily translate".

Casting


In June 2013, Robert Downey Jr. signed on to return as Tony Stark / Iron Man for a third Avengers film, and Josh Brolin signed a multi-film deal the following May, to play Thanos. In July 2014, Feige stated that actors from previous MCU films were under contract to return to for a third Avengers film, with Jeremy Renner stating that September he was signed on to reprise the role of Barton. After the announcement of Infinity War and Endgame, many established MCU actors were confirmed to be joining Downey and Brolin, including previous members of the Avengers Chris Hemsworth as Thor, Mark Ruffalo as Bruce Banner / Hulk, Chris Evans as Steve Rogers / Captain America, Scarlett Johansson as Natasha Romanoff / Black Widow, Don Cheadle as James "Rhodey" Rhodes / War Machine, Paul Bettany as Vision, Elizabeth Olsen as Wanda Maximoff, and Anthony Mackie as Sam Wilson / Falcon. Infinity War also sees the Avengers unite with the Guardians of the Galaxy, including Chris Pratt as Peter Quill / Star-Lord, Pom Klementieff as Mantis, Karen Gillan as Nebula, Dave Bautista as Drax, Zoe Saldaña as Gamora, Vin Diesel as the voice of Groot, and Bradley Cooper as the voice of Rocket. Sean Gunn served as the on-set stand-in actor for Rocket on both films.

Additional actors reprising their roles in Infinity War from the various MCU franchises include Benedict Cumberbatch as Stephen Strange from Doctor Strange, with Benedict Wong as Wong; Tom Holland as Peter Parker / Spider-Man from Spider-Man: Homecoming (2017), with Jacob Batalon as Ned, Isabella Amara as Sally, Tiffany Espensen as Cindy, and Ethan Dizon as Tiny; and Chadwick Boseman as T'Challa / Black Panther from Black Panther, with Danai Gurira as Okoye, Letitia Wright as Shuri, Winston Duke as M'Baku, and Florence Kasumba as Ayo. Sebastian Stan also appears as Bucky Barnes / Winter Soldier from the Captain America films, along with Tom Hiddleston as Loki and Idris Elba as Heimdall from the Thor and Avengers films; Iron Man supporting actress Gwyneth Paltrow as Pepper Potts; Benicio del Toro as Taneleer Tivan / The Collector from Guardians of the Galaxy; William Hurt as Thaddeus Ross, who first appeared in The Incredible Hulk (2008); and Kerry Condon as the voice of Iron Man's A.I. assistant F.R.I.D.A.Y. Samuel L. Jackson and Cobie Smulders make uncredited cameos in the post-credits scene as Nick Fury and Maria Hill, who they respectively portrayed in several previous films. Jon Favreau was to reprise his role as Harold "Happy" Hogan, while co-director Joe Russo had a cameo appearance as a paparazzi photographer, but this scene did not make the theatrical cut of the film. Michael Rooker, who played Yondu Udonta in the Guardians of the Galaxy films, visited the Georgia filming set for some days while wearing an Infinity War production cap, but it later turned out that he was merely present there to throw off spoilers that Udonta would die in Vol. 2 as rumors prior to that film's release as part of a publicity strategy to distract fans.

In early January 2017, Peter Dinklage was in negotiations to appear in the films, and was eventually cast in the role of Eitri. At D23 Expo 2017, Marvel announced the inclusion of the "Children of Thanos", Thanos's henchmen in the film. Known collectively in the comics as the Black Order, the actors playing the characters were soon revealed to be Tom Vaughan-Lawlor as Ebony Maw,  Terry Notary as Cull Obsidian, Carrie Coon as Proxima Midnight, and Michael James Shaw as Corvus Glaive. Midnight was portrayed on-set by the stuntwoman Monique Ganderton while Coon recorded her dialogue and performed motion capture for her facial expressions during post-production due to her pregnancy at the time. James Shaw had previously auditioned for M'Baku in Black Panther and was invited by Marvel to audition for Glaive in Infinity War while working on a workshop of a play by David Byrne from Talking Heads; Shaw initially declined due to his busy schedule with other two projects, but by January 2017, his schedule cleared up and was able to participate in all three, specifically enjoying interacting with the Black Panther actors after not getting the part of M'Baku. Joe Russo explained that the Black Order was included in the film so that there were characters that the heroes "have to go through to get to" Thanos rather than have them challenge him "every step of the way". He added that Supergiant, a member of the comics version of the Black Order, was not included because "consolidation seemed like a smart thing ... they were starting to overlap each other". The Black Order in the film have altered powers which the Russos "felt were in better service of our storytelling". Emma Fuhrmann was cast as an older Cassie Lang, replacing her Ant-Man (2015) and Ant-Man and the Wasp actress Abby Ryder Fortson, in Endgame. Fuhrmann auditioned for the role in June 2017, though she at first believed that she was auditioning to play a younger Black Widow as the film was still untitled by that point; even Marvel making her audition with a fake scene as a fake character. Upon being informed of her role upon her casting, Fuhrmann sought Cassie Lang's Wikipedia page, watched all Marvel films in order, and once on the set read a few comic books. Ross Marquand voices Red Skull, the "Stonekeeper" guarding the Soul Stone. Marquand replaces Hugo Weaving, who had expressed reluctance to reprise the character from The First Avenger; Weaving was approached to reprise the role, as he had originally signed for three films. However, Marvel pushed back the contracts that they agreed early on and offered him less money than he got for The First Avenger under the pretext that it would be only simple voice work. Consequently, Weaving desisted from reprising the role when he and his agent found it impossible to negotiate with the studio. Marquand, who is known for his celebrity impressions, said that Marvel was looking to "come as close to the iconic role that Hugo Weaving portrayed seven years ago and pay homage to it while also giving it a new flavor", and after Marquand attempted to "do a straight voice match to Hugo's performance", the Russo noted that the character would "sound a little different" from the last time he was seen, recommending Marquand add "this kind of ethereal almost ghost-like quality to his voice", as well as adding a wise-like tone like that of Yoda of the Star Wars franchise that would give the impression the character had been there for thousands of years like "Atlas holding the sky". Taking this direction, it took Marquand around 10 days to perfect the voice, which he felt melded Weaving's "iconic performance in The Matrix (1999) with the German accent he used for the Red Skull. Red Skull was created through CGI and portrayed with stand-ins on set. By October 2017, Hiroyuki Sanada had been cast as Akihiko for Endgame. Sanada had originally been offered to play Zero in John Wick: Chapter 3 – Parabellum (2019), but an Achilles tendon injury forced him to leave the role for Mark Dacascos, so he saw his casting as Akihiko as a "consolation prize". A year later, Katherine Langford was revealed to have been cast in Endgame. Langford was to play the older version of Morgan Stark, who Stark sees in a vision after his snap, but the Russos cut her scene as they felt that it would be too confusing. Newcomer Jack Champion was cast as the kid whom Scott Lang comes across upon his return from the Quantum Realm. Champion only had a one-day shoot which he spent with Paul Rudd, whom he felt to be one of the friendly actors he has worked with. Reginald VelJohnson was cast as a fire chief for an Endgame scene which took a week to film in Atlanta after the Russos contacted his agent due to being fans of his work; VelJohnson's scene was not kept in the theatrical cut of the film, but was later included when the film was re-released in theaters with bonus content.

Actors who returned for Endgame include: Downey, Hemsworth, Ruffalo, Evans, Johansson, Cumberbatch, Cheadle, Holland, Boseman, Olsen, Mackie, Stan, Hiddleston, Wong, Klementieff, Gillan, Bautista, Saldana, Cooper, Paltrow, Brolin, Pratt, and Wright. Olsen was not contractually obliged to return due to Infinity War fulfilling her original three-film contract with Marvel, but Feige persuaded her to return in Endgame by pitching her the concept of the then upcoming Disney+ series WandaVision (2021). They were joined by Jeremy Renner as Clint Barton, Evangeline Lilly as Hope van Dyne, Favreau as Happy Hogan, Rudd as Scott Lang, Brie Larson as Carol Danvers, Michelle Pfeiffer as Janet van Dyne, Michael Douglas as Hank Pym,  Tilda Swinton as the Ancient One, and Frank Grillo as Brock Rumlow / Crossbones. Grillo initially turned down the offer to return, as he had grown dissatisfied with how his character had been handled in the MCU in spite of his initial seven-picture deal, even hanging up on the Russos when they called him to ask if he could come for a week to the Avengers set without specifying to him what he would do. He ultimately agreed to return at the insistence of his son, who reminded him how good he had felt on the sets of The Winter Soldier and Civil War in addition to assuring him that Endgame would be the "biggest movie" in the world. Vaughan-Lawlor, Notary, Ganderton, and Shaw reprised their roles as the "Children of Thanos" from Infinity War respectively; Coon was unable to reprise her role as Proxima Midnight due to a scheduling conflict, so Ganderton played the role solely and the character was given a non-speaking part with no close-ups. Ty Simpkins reprised his Iron Man 3 (2013) role as Harley Keener; Sympkins was called by his manager, who told him that Marvel Studios was considering to bring him back, which Marvel confirmed to him in a later call, though Simpkins chose not to tell his family at first as he was not sure he would be appearing in the film. Stellan Skarsgård, who portrays Erik Selvig in the MCU, said he believed he would appear in one of the films as he had one more film left on his contract, and would not be appearing in Ragnarok. Despite having declared to be "done" with the franchise after The Dark World, Natalie Portman reprised her role as Jane Foster from the Thor films for the 2013 sequence; Portman's reprisal was achieved through archive footage from The Dark World to physically represent the character while Portman recorded a single line of dialogue new for the film. For the 1970 sequence, John Slattery returned as Howard Stark alongside James D'Arcy who reprised his role as Edwin Jarvis from Agent Carter, marking the first time a character introduced in an MCU television series appears in an MCU film. Reed Diamond, who appeared as Hydra member Werner Reinhardt / Daniel Whitehall in the series Agents of S.H.I.E.L.D. (2013–2020), had been approached by Marvel Studios regarding his availability for Endgame, with visual effects company Cantina Creative eventually using a photo of Whitehall in imagery for the film's time heist information screens, which was ultimately cut. The imagery would have also featured the likenesses of previous MCU actors such as Erich Redman as Schneider, Anatole Taubman as Roeder, Toby Jones as Arnim Zola, Thomas Kretschmann as Baron Wolfgang von Strucker and Claudia Kim as Helen Cho.

The Russos hoped to have another actor from their TV series Community (2009–2015) make a cameo appearance, after Danny Pudi and Jim Rash appeared in The Winter Soldier and Civil War, respectively. David Cross was invited to make a cameo appearance as Tobias Fünke in Infinity War, his character from the sitcom Arrested Development (2003–2006, 2013–2019), which the Russo brothers had previously worked on; this was prevented by a scheduling conflict, but Fünke still appears in the film as a specimen in the Collector's collection, played by an uncredited extra. Yvette Nicole Brown and Ken Jeong, who played Shirley Bennett and Ben Chang, respectively in Community, appeared in Endgame as a Camp Lehigh agent and a security guard. Jeong was also at one point going to voice Howard the Duck, replacing his Guardians of the Galaxy actor Seth Green, in Infinity War before the Russos decided that his inclusion did not fit the film. Green was unaware of Howard's appearance in Endgame until he saw the film. Avengers co-creator Stan Lee makes cameo appearances in both films. Starlin indicated he was interested in making cameo appearance in the films, appearing in Endgame as a grieving man.

Design
Production designer Charles Wood previously worked on The Dark World, Guardians of the Galaxy, Age of Ultron, and Doctor Strange, but found the increase in scale with Infinity War and Endgame to be a particular challenge. He felt that revisiting the sets of Doctor Strange in Infinity War was particularly helped by his experience on the original film, allowing for continuity between the two films. For the nation of Wakanda from Black Panther, that film was being produced in Atlanta at the same time as Infinity War so Wood and his team worked with the Black Panther production team to ensure a unified presentation of the country.

In January 2017, Wood stated that the two films would be introducing "many, many, new worlds" outside of Earth and others previously established in prior films. When designing Thanos's homeworld Titan, Wood intentionally wanted it to be as different from Wakanda as possible so the audience would not be confused when Infinity War cuts between both locations. The process for Titan started by designing what it looked like in Thanos's youth, with structures inspired by windmills forming the basic shapes of the planet's buildings. The team then designed the post-apocalyptic version of Titan that is seen in the film. An early idea was to film these scenes on location in the Atacama Desert in Chile, and though this idea was abandoned, the look of the planet was still inspired by that location. The production design team also looked at icebergs in Antarctica while trying to depict the structures on Titan falling apart in low gravity. Sand dunes in the Atacama Desert were also used as inspiration for the planet of Vormir, though the focus of the design of that planet was making the clouds look unnatural to give the sky a dream-like quality. The location of Nidavellir took more inspiration from the comic books.

Costume designer Judianna Makovsky focused on making clothes that fit the realistic style of the Russo brothers. For the civilian clothes worn early in Endgame, Makovsky wanted to adjust the color palette to be less bright than previous films to not draw away from the characters and storyline. The clothes worn by a depressed Thor were meant to still evoke his traditional costume, such as a bathrobe in the same red as his cape. For the digital characters in the films, Makovsky created clothes for small maquettes of the characters which the visual effects team could then replicate. The time-travel suits in Endgame were designed by Marvel's head of visual development Ryan Meinerding to combine elements of the technology related to Ant-Man, Iron Man, and the Guardians of the Galaxy. Because of how busy the costume team was during production, the time travel suits were never actually made for the film. Instead, after the design was finalized, the suits were created digitally. Wood designed the time-travel devices worn on the heroes' wrists.

The company Perception helped the production team visualize their concept of time travel in the film, focusing "on the mechanics of how it might work, what it might look like, and how you would explain it". The team at Perception explored "ideas surrounding scientific considerations, technology-based concepts, and potential narrative influences". Perception also worked on the closing credits for Endgame, opting to create "something that felt personal [and] sentimental", that would also remind the viewer of "the last ten years" of the MCU and was "a love letter to the fans". The credits were broken down into three sections–the crew, the cast, and then the "hero 6" which featured the original six Avengers from the first film–and featured over 60 unique title cards. Unlike traditional credit order, Marvel Studios wanted the credits to build to the original Avengers, which meant putting the top billed actors at the end of the sequence instead of the start. Perception used abstract light rays that became more distinct as the sequence progressed. For the cast credits, footage from past films was used for each actor, "specifically selected not just for the way it interacted with the light but also for its iconic power". Finally, the hero section featured an image of the actor in the foreground with footage of their character in the background as well as the actor's signature. Featuring the signatures was an idea from Feige to create "a more personal and intimate connection". Perception again created the main title sequences for the films as well.

Originally, three separate War Machine suits would appear in Endgame: the repaired Mark III from Civil War, the Mark IV used throughout Morag before dissolving in acidic water in an underwater sequence, and the Mark V, dubbed the "cosmic War Machine armor", for space use. Ultimately, the Mark III armor and underwater sequence were cut, and Rhodes uses the Mark VI on Morag during the attack on Avengers HQ and the Mark VII "Iron Patriot" suit for the final battle.

Filming plan
The films were originally scheduled to be shot concurrently, with the Russos suggesting that "some days we'll be shooting the first movie and some days we'll be shooting the second movie. Just jumping back and forth". Anthony Russo felt it made more sense to shoot the films simultaneously, due to financial and logistical reasons, considering the large number of cast members, even though each part is its own distinct film. At the end of April 2015, Evans revealed that filming was scheduled to start in late 2016 and take place over nine months, lasting until August or September 2017. In January 2016, the Russos stated that filming would take place in Atlanta, Georgia, beginning in November 2016 and lasting until June 2017. In October, Feige stated that filming would begin in January 2017.

Renner, Olsen, and Bautista noted that the actors appearing in the films had not received scripts before the start of shooting, with Bautista specifically stating on January 22, 2017, that he had not received a script, despite beginning his filming on January 23. No actor in Infinity War had the entire script, though some who were in the film had access to more scenes than others. Additionally, fake and redacted scenes were used to help protect the secrecy surrounding the film. In April 2017, Feige revealed that the sequels were no longer being filmed simultaneously as originally planned, but rather back-to-back, and indicated that filming for [the Infinity War sequel] Endgame would commence in August 2017. He explained, "We're doing them one right after another. It became too complicated to cross-board them like that, and we found ourselves—again, something would always pay the price. We wanted to be able to focus and shoot one movie and then focus and shoot another movie". As this decision was made a few months before the start of filming, some of the pre-production work was negatively affected. Some scenes from both films did ultimately get shot on the same day, mainly to accommodate actor availability.

Principal photography
Principal photography for Infinity War began on January 23, 2017, at Pinewood Atlanta Studios in Fayette County, Georgia. The working title Mary Lou was used as a reference to gymnast Mary Lou Retton, because the production wanted to "stick the landing" with the two films as an ending for the MCU's Infinity Saga. Pinewood Atlanta co-owner Dan T. Cathy described the films as "the largest film production ever with a [combined] $1 billion budget", which Feige stated was false; the first film had an estimated budget of $325–400 million, still making it one of the most expensive films ever made. Evans and Hemsworth earned $15 million each for both films.

Additional filming occurred in Scotland, including in Edinburgh, Glasgow, and the Scottish Highlands, with studio work taking place at Wardpark Studios in Cumbernauld. Filming in Scotland began on February 28, 2017. From March 18 through April 21, 2017, filming occurred in Old Town, Edinburgh on and around the Royal Mile, including High Street, Parliament Square, Cockburn Street, and Roxburgh Close and Old Fishmarket Close, as well as Waverley Station. Filming also took place at Durham Cathedral in Durham, England, in early May 2017 and in St Abbs. These scenes were actually shot for Endgame, with Durham Cathedral portraying 2013 Asgard, and St Abbs doubling for the town of New Asgard in Norway. Filming also occurred at St Giles' Cathedral and Inverness Castle. Other scenes shot for Endgame in 2017 were that of 1970 Camp Lehigh and 2012 Loki escaping with the Tesseract from the Stark Tower. In late June 2017, filming occurred in Downtown Atlanta, as well as Atlanta's Central Park in early July, before moving to Queens, New York in the middle of the month. Marquand shot both his Infinity War and Endgame scenes as Red Skull in just one day within eight hours, during which the writers informed him about who the characters with codenames actually were. For Infinity War final scene, the filmmakers partnered with Indochina Productions, a studio based in Thailand, to acquire footage of the Banaue Rice Terraces at Ifugao, Philippines. According to Starlin, a 45-minute prologue depicting Thanos stealing the Power Stone from Xandar was originally shot to open the film instead of with the Children of Thanos' attack on the Statesman, but the Russos had the sequence cut because the filmmakers did not wish to spend money on the scene's special effects nor to make the film as long as Endgame. Filming of Infinity War concluded on July 14, 2017. The actors whose characters perished from Thanos's snap were shown previsualization of the scene on the day it was being filmed, which was the first time they had been aware of their characters' fates.

Filming for Endgame began on August 10, 2017, also at Pinewood Atlanta Studios, under the working title Mary Lou 2; the second film had an estimated budget of $356–400 million. In August, filming occurred in the Gulch area of Downtown Atlanta, near the Five Points MARTA station, as well as in Piedmont Park. For Nebula's scenes with Thanos in this film, Joe Russo served as a stand-in for the character due to Brolin's unavailability at the time, so Gillan filmed her scenes with Russo, who merely wore his usual clothes and the headpiece depicting Thanos's head on cardboard to motion capture him. Throughout the shooting, some actors were kept in the dark about the film's plot; Champion recalled that when he and Rudd filmed their scene together, the missing posters seen in the finished film were absent from the pole, making his confused reaction to Scott Lang's question genuine. To maintain the film's secrecy, at least Holland and Stan were told that they were filming a wedding when the crew shot Tony Stark's funeral. According to Smulders, no actor had to be digitally inserted into the scene, as Marvel was able to include all the actors whose characters attended Stark's funeral in spite of potential scheduling conflicts. Further filming locations in the Atlanta area included a lakeside cabin in Fairburn, Georgia, which is where the Stark family lives in the film, as well as several locations that were used to portray the Avengers Compound: the Porsche Experience Center in Atlanta and an empty conference room in a semi-abandoned Sheraton Hotel near Atlanta Airport. Production on Endgame wrapped on January 11, 2018.

Cinematography
Trent Opaloch served as director of photography for the two films. Ahead of filming, the Russo brothers announced that both films would be shot using Arri Alexa IMAX cameras, the first time that a Hollywood feature film was shot entirely with IMAX digital cameras. The footage was digitally processed by IMAX and released in a 1.90:1 aspect ratio exclusively in IMAX theaters. Joe Russo said that because many of the characters are tall, the "IMAX aspect ratio works for those types of characters, and the landscapes are stunning. There are some really exotic landscapes in the film, and to be able to put those on an IMAX screen, it's an incredible tool to have as a filmmaker to be able to exploit that scale of aspect ratio." Opaloch noted that the production would use 12 of the Arri Alexa IMAX cameras, and that Arri was working on lenses with additional focal lengths for the camera. They hoped they would be available by the start of filming, since the production would "need all the accessories and lenses", as it was "such a behemoth of a project".

Infinity War was shot mostly with a single-camera setup, opposed to the three-camera setup used by the Russos on the Captain America films. The Russos went with this approach to make Infinity War "look bigger" over "the vérité look" the Captain America films had with three cameras. Opaloch described his visual style as more focused on the needs of each scene rather than an overall visual look for the films. For the scenes in Endgame that were recreating moments from previous films, Opaloch started by trying to replicate the work of the cinematographers on those earlier films, but then moved where the new scenes required him to. Approximately 890 hours of footage was shot between both films.

Opaloch says that the lighting in the scene with Stark sending his goodbye message to Potts "shows you where he is emotionally and physically" with the cyan coloring coming through the ship's window representing deep space and the starscape. The scene was filmed vertically with a steep ladder placed on a gyroscope so that it could be moved to simulate the movement in space, with the lighting placement being difficult to get right. While blocking the scene, the crew had to add a bank of lights underneath Downey so that there was "something in his low looks". For New Asgard, natural lighting was used in contrast to most of the rest of the film because they are in otherworldly environments.

Post-production
Post-production for Endgame began in earnest after the release of Infinity War, with Feige explaining that the second film would have a slightly longer time in post-production than some of Marvel's other films. Joe Russo ultimately felt that Endgame was his and his brother's "best work for Marvel", and felt that because the majority of the film was made before Infinity War released and the audience was able to respond to it, the sequel was "really pure... without any sort of external noise creeping in" to the story.

Editing
Jeffrey Ford and Matthew Schmidt served as editors for Infinity War and Endgame. Ford's process was to watch through dailies as they came in from set in the order they were filmed to see the progression of the actors performances. He would put together an early cut of the footage the day it was filmed, and then return to that cut at least several hours later if not the next day. Ford would then share his cuts with the Russo brothers on set, and when possible, would sit with the directors when they were not busy filming to go through footage up to that point. Due to the many visual effects required for the films, Ford worked with Gerardo Ramirez of The Third Floor to include previsualized sequences in the early cuts, as well as postvisualizing by adding basic effects such as backgrounds to the dailies. Ford also worked with Shannon Mills from Skywalker Sound to add early sound to his rough cuts.

Ford stated there was "a pretty solid cut" of Infinity War by October 2017, but the film was constantly being edited and restructured until very late in the process "until it sort of clicked in". Ford explained that the restructuring was focused on adjusting the rhythm of the film where the hand-offs between characters and storylines take place. This was important to get the pace of the film right, as early versions of the film were shorter than the final two-and-a-half hour runtime but felt slower when shown in test screenings. During filming, both editors worked on compiling the material from both films as it was given to them. Around December 2017, Ford began working exclusively on the edit for Infinity War, while Schmidt continued compiling the Endgame footage. Of his work on Infinity War, Ford was most proud of how he shaped the actors performances. Ford noted that the Avengers films are largely character-driven, with the action sequences involving a large amount of character moments. He had to work with several motion capture performances with the film, but Ford was able to cut these performances just as he would a traditional performance because the motion capture actors were on set with the other actors, and the visual effects team ensured the actors all had the correct eye-lines to match the characters that would be added digitally.

Once Infinity War was preparing for release, both Ford and Schmidt began "working in earnest" on Endgame, with editing beginning a few weeks before the release of Ant-Man and the Wasp in July 2018. Tia Nolan, Peter S. Elliot, and Craig Tanner all served as guest editors on Endgame to help Ford and Schmidt complete the film on time. In early November 2018, the Russo brothers said they were "about halfway through" editing the film. Ford described Endgame as "less editorially driven" than the previous Marvel films he had worked on, including Infinity War, with the mise-en-scène style of the sequel driven more by the blocking of the actors and camera on set than the editors' direction. Several shots in the film had to be stitched together by the editors and visual effects team from different pieces filmed at different times during production, including an action scene with Hawkeye in Tokyo that is shown as a single long take but was actually filmed in three or four different sections on a street in Atlanta. Because composer Alan Silvestri was unable to work on the score for Endgame until long after editing had begun for the film due to other commitments. Ford and his team used music from Silvestri's previous scores as part of a temp score. In March 2019, the Russos confirmed that the final film edit for Endgame was locked.

Additional photography
Joe Russo stated in July 2017 that there were a couple of unfinished scenes for Infinity War that would be shot "in the next few months". In March 2018, Marvel approached the Hudson Valley Film Commission about finding a location to film an Endgame battlefield in upstate New York. The commission suggested eight different properties, and Marvel chose the Staatsburgh State Historic Site in Dutchess County. The property was filmed over several days in June 2018 to get footage for the visual effects team. The Black Creek Preserve in nearby Ulster County was also filmed. Visual effect plates for Endgame were also filmed in Tokyo and Brazil, the latter for portraying an alien planet.

The Russos revealed on September 7, 2018, that main additional photography for Endgame had begun, with the cast returning to the Atlanta set. This was completed on October 12. During the shoot, motion capture footage was refilmed as requested by Weta Digital, while notes taken by Weta Digital Animation Supervisor Sidney Kombo-Kimboto for revisions on various story points had also been used as basis for the shoot. Weta Digital Visual Effects Supervisor Matt Aitken also attended the shoot. Due to the amount of filming that was required for these reshoots, the production split into four units, with the Russo brothers taking one each and the other two being supervised by visual effects supervisor Dan Deleeuw and Ford, respectively. Ruffalo indicated that beyond reshooting material, the additional photography would be used to finish the film since it had not been fully completed earlier in the year. Markus and McFeely described the additional photography as mostly adding things that they did not realize they needed, as well as a few things that they knew they needed but had been unable to film until then. Ford explained that these reshoots covered many parts of Endgame, including completing the final battle sequence. An important change was adjusting the presentation of the two versions of Nebula in the film since it was easy to tell the two apart in the script by their labels "Good Nebula" and "Bad Nebula" but less clear which was which on-screen. Another major change made through reshoots was altering the scene in which Romanoff dies: Originally, the scene featured her and Barton fighting Thanos and his forces, but in post-production, the antagonists were removed from the scene. One year after filming her scenes, Tilda Swinton was brought back for reshoots. Some key time-travel plot points had changed, leading to the inclusion of the scene where the Ancient One shows Hulk a visual timeline to explain to him the consequences if their mission fails. Thor was not originally planned to join the Guardians of the Galaxy at the end of the film, a decision that was made during the editing phase.

Some final reshoots for Endgame occurred in January 2019, including the climax of Endgame where Tony Stark uses the Infinity Stones. Originally, this scene did not have any dialogue for Thanos or Stark, but the line "I am inevitable" was added to Thanos to complete that character's arc in the film, which is about his sense of destiny. During editing, the directors decided that it was out of character for Stark not to say something back, and Ford suggested the line "I am Iron Man" as a callback to the first Iron Man film. Adding this line was a significant reason for the January 2019 reshoots, which took place at Raleigh Studios, California, where Downey first screen-tested for Iron Man. At first, Downey did not want to return just to shoot the "I am Iron Man" line, but Feige and the Russos convinced him that the line was necessary to the film's story after the Russos realized during editing how to improve the storytelling.

Visual effects
Visual effects for Infinity War were created by Industrial Light & Magic (ILM), Framestore, Method Studios, Weta Digital, DNEG, Cinesite, Digital Domain, Rise, Lola VFX, and Perception. These vendors were given sequences from the film beginning in February 2017. ILM, Weta Digital, DNEG, Framestore, Cinesite, Digital Domain, Rise, Lola VFX, and Perception all returned for Endgame, and were joined by Cantina Creative, Capital T, Technicolor VFX, and Territory Studio. Endgame has over 3,000 visual effects shots.

Infinity War
Digital Domain worked on creating Thanos for the film, producing over 400 visual effects shots. The company created a new facial capture application called Masquerade, based on the concept of machine learning through computer algorithms, specifically for the film, beginning work on the system 3–4 months before filming began to develop and test it. They presented their results to Brolin, the Russos, and executives from Marvel ahead of filming to demonstrate the subtleties Brolin would be able to bring to the character, which helped inform Brolin how to portray the character. Before the start of filming, Brolin's facial expressions were captured with ILM's Medusa system, which along with his motion capture data from set, were fed to Masquerade to "create a higher-resolution version of what Brolin did on set" so animators could apply that to the CGI character. Kelly Port, Digital Domain's VFX Supervisor, noted the design of Thanos took into account the versions that appeared in previous films, but were adjusted more toward's Brolin's features, which also helped with matching his performance to the digital character. Weta Digital worked on the fight on Titan, where they also created a separate version of Thanos for their needs, applying the performance capture data to the tools Weta developed for their work on the 2010s Planet of the Apes series. Weta worked on 200 shots of him, along with their 250 other effects shots, that included the Titan environment and the other characters in the fight.

Digital Domain also created Red Skull, and was aided by reference material from The First Avenger to create the CGI character. Port noted there was "a wide spectrum of designs in terms of what he would look like", with some options including having Hugo Weaving reprise the role with make-up, had he returned, and a version "where the Tesseract did very bad things to his appearance, so he was much more skeletal". The final character design was "in between", one that "showed both that the Tesseract did affect him and choose him in some kind of way to be the guardian of the Soul Stone.

Framestore created 253 shots for the film for the New York fight sequence in the first act of the film. Patric Roos, Framestore's VFX Supervisor, called their shots a "mix of full CG shots, plate shots, FX, set extensions, magic spells and a lot of character work". A portion of the fight sequence was shot in Atlanta, before moving to a fully CGI Washington Square Park. Framestore's Capture Lab spent a month in Manhattan and New Jersey shooting photo reference, LIDAR and gigapixel panoramas to capture the environments that had to be recreated digitally, capturing more than 250,000 photos and 15 TB of data. For their work on the Children of Thanos, Framestore spent close to a year developing their models, working with Marvel Studios' visual development team to create animation vignettes to explore each member's personality and character traits. Framestore also created Stark's new Iron Man's suit, the Mark 50, that is made up of singular nanobots which move around his body to form a suit, and was developed alongside Marvel for about two years. They also created Parker's Iron Spider armor suit. The models and textures for the Iron Spider suit were shared with fellow visual effects vendor Trixer in order for them to implement them in Homecoming where it was first seen. Framestore also worked on the Children of Thanos's Q-Ship, and Strange's "Eldritch magic", which was updated from its first appearance in Doctor Strange. Cinesite's work on the interior of the Q-Ship when Ebony Maw interrogates Strange consisted of 215 shots. The company also worked on the small fight between Stark, Parker, Strange and the Guardians on the ship, which required full character animation, blaster and web effects, CGI daggers, Quill's mask, Mantis's antennae, and damage to the Q-Ship. The post-credits sequence, the opening scene in Central Park, the scene when T'Challa presents Barnes with his new arm, interior shots of the Quinjet, and an establishing shot of the planet Vormir were created by Rise, which totaled 26 shots. For the post-credits sequence, Oliver Schulz, Rise's VFX Supervisor, noted the company had done a similar fading effect for a previous commercial project, so those assets were used as a baseline. The company also received digital assets of Cobie Smulders and Samuel L. Jackson from The Winter Soldier for use in the scene. Schulz noted that part of the sequence's difficulty was because "at a later point in the process the decision was made to not move forward with the filmed plate of Nick Fury—instead we would do a camera takeover and switch to a full CG shot. This included a full CG arm crumbling away in close-up together with a full CG environment. Additionally were also the CG close-up pavement and the all CG pager—which reveals the illuminated Captain Marvel Logo at the end".

Endgame
To create the look of Hulk's redesign in Endgame, visual effects supervisor Dan DeLeeuw said that the team worked with the Hulk's digital model from previous films and started to change it to look more like Ruffalo. DeLeeuw revealed that "the more you can bring in of the actor portraying the character, the better the performance will be that comes through", which they first discovered while designing Thanos. ILM and Framestore captured an incredible amount of detail in Ruffalo's performance according to DeLeeuw, which caused the visual effects team to have to upgrade the software and techniques to be able to "support and carry those subtle details of his performance forward and get them into the character". ILM used a performance capture technology called Anyma which had been in testing since 2012. Anyma analyzes pixel-level detail and according to ILM visual effects supervisor Russell Earl, "existing performance capture systems largely rely on dots that are glued all over an actor’s face to capture basic facial expressions. Anyma on the other hand can capture pore-level information, which can then used by animators to control over 200 individual facial attributes". Hulk was the first Anyma captured character to appear in a theatrical released film.

As with previous MCU films, Lola worked on digital de-aging sequences and also digital aging effects with Endgame featuring 200 de-aging and aging shots. Downey, Evans, Ruffalo, Hemsworth, Johansson, and Renner were de-aged to their 2012 appearances for scenes recreated from The Avengers. Douglas, Slattery, and Lee were also de-aged for the 1970 New Jersey sequence; Douglas's appearance in The Streets of San Francisco (1972–77) was referenced for his effects. Lola aged-up Evans for the final scene where he is portrayed as an elderly man, using some makeup and a stand-in as reference. Mackie recalled that for the climactic scene with an aged Steve Rogers, the filmmakers initially had "wanted to cast an old dude to play Chris Evans. So they brought in, like, three actors. They're, like, none of these [is] how Chris will look when he's old. ... He's going to be 95 and still handsome, you know? So they brought in a makeup team and prosthetics and made [Evans] into an old man." Much of the aging of Evans in the final shots is digital, with visual effects supervisor Dan Deleeuw explaining that the scene was shot with Evans and "an older-age double. You have [the double play] the scene watching Chris running the scene the same way. And so, when you have Chris's performance and kind of a reference for the older skin, you're able to basically marry [and] take the texture from the older skin and apply it to Chris Evans with some combination of CG and painting mixed in".

Weta Digital worked on the Battle at the Avengers Compound sequence. After receiving the plate shots and unedited footage from production, animation supervisor Sidney Kombo-Kintombo begun drawing on the plates to provide visual references. He called this stage "breaking down the plate". His production manager, Eleanor Morris, also took notes on what Kombo-Kintombo said in order to catalog the tasks for the team. Kombo-Kintombo requested Marvel Studios perform additional reshoots of motion capture footage to revise the scene's mid-ground action, and provided new story points focusing on the scene's progression. He also suggested the "women of Marvel" scene, which was created with only a day of previsualization. The team used existing plates, new elements, and reference animation to construct the final scene, which was approved by Marvel Studios. One of the last visual effects additions to the film was a quick cameo of Howard the Duck during the Battle at the Avengers Compound sequence. The character was not intended to appear in the film, but during examination of the "Avengers assemble" scene three weeks before visual effects were completed, Joe Russo or Feige suggested to visual effects producer Jen Underdahl that the character be included. Underdahl contacted Weta, who used an older model of Howard the Duck from previous MCU projects as reference. They had to quickly prepare an updated model so the character could be added for approximately 17 or 18 frames. There were also talks of digitally inserting Cassie Lang into the funeral sequence as a guest, because she was not included in the original filmed version, but the filmmakers decided against it because the attendants were honoring Tony Stark's sacrifice and her inclusion was not necessary.

Music
Alan Silvestri, who composed the score for The Avengers, was revealed in June 2016 to be returning to score both Infinity War and Endgame. Silvestri started to record his score for Infinity War in January 2018, and concluded in late March. In early November 2018, the Russos had started to work with Silvestri on the score for Endgame, and scoring for the second film concluded in late March 2019. The films' scores were recorded at Abbey Road Studios in London with the London Symphony Orchestra.