As the steamy Fifty Shades of Grey opens this weekend at nearly 3,600 theaters nationwide with a projected opening box office of $80 million, songwriter Stephan Moccio will likely have a bigger if less libidinous grin on his face than most of the hot and bothered masses flocking to the film.

That's because for this major studio release he will have managed to capture lightning in a bottle -- not once -- but twice. The 42-year-old composer co-wrote, co-produced and ultimately landed the film's two end credits in The Weeknd's "Earned It" and Skylar Grey "I Know You" after coming exceedingly close to getting nothing.

'Fifty Shades of Grey' Soundtrack Aiming to Tie Down No. 1

"It was 'Wrecking Ball' that got me in the door," says Moccio, who co-wrote Miley Cyrus' 2013 smash with Sacha Skarbek and Maureen "MoZella" McDonald. The song hit the top of the Hot 100 the day Moccio unpacked his bags in his new Palisades home after moving to Los Angeles from Toronto.

"A few weeks later I took a meeting with Mike Knobloch [president of film music and publishing at Universal Pictures] and he asked me to take a stab at writing the end title for Fifty Shades."

A gifted composer who loves classical and pop equally, Moccio had massive hits in his native Canada before he headed to the lower 48. This includes Celine Dion's "A New Day Has Come," which he co-wrote with Aldo Nova, and "I Believe," the 2010 Vancouver Olympics theme co-written with Glass Tiger's Alan Frew and recorded by Nikki Yanofsky. And there's another song that made him something of a national deity: "I wrote the theme song for NHL hockey," Moccio says, "which is a religion in Canada."

Moccio, who has a shock of mussy dark hair like a mid-'60s Dylan with a pop star's chiseled good looks, is sitting in his Santa Monica studio. He spent the day with Skylar Grey at a beautiful downtown theatre shooting the video for for "I Know You," which he says will be "classic, classy and very minimal." He now awaits the Weeknd's arrival to continue work on his new record. The duo will then fly to New York to perform "Earned It" on the The Tonight Show Starring Jimmy Fallon.

"Earned It" is hot. It's No. 29 on this week's Hot 100 and its YouTube tally is up to nearly 17 million views. When the Weeknd walked out on the Grammy stage at L.A.'s Staples Center to introduce Pharrell while strands of "Earned It" played, hooting and hollering erupted erfrom the rather staid audience. And at a Grammy Week performance, the Weeknd closed out his set at the EL Rey with the throbbing track that absolutely demolished the venue, leaving the packed theatre screaming. The film's soundtrack on Republic is now forecasted to top next week's Billboard 200.

Evan Lamberg, president of North America at Universal Music Publishing Group, who signed Moccio, first met the composer through BMI's Barbara Cane. After spending two days in Moccio's Toronto studio, Lamberg says he "came out of there in a daze" after observing him orchestrating and arranging his track for the Winter Olympics.

"I knew this guy was writing timeless pop songs for people like Celine Dion and others," he says, "but I felt like I was in a room with Mozart."

From left: Composer Stephan Moccio, The Weeknd, Evan Lamberg of Universal Music Publishing Group at Moccio's Santa Monica studio. (Photo courtesy of UMPG)

Lamberg, whose idea it was to pair him with Skylar Grey, compares Moccio to such well-known pop production machines as Stargate, Max Martin and Ryan Tedder, and has absolute faith in the composer and producer. From the moment he signed him in 2010, he has devoted himself to developing Moccio's career. Lamberg was behind the composer's move to L.A., put him up in a studio across the street from his office introduced him to countless songwriters and opportunities and was instrumental in helping him obtain projects like the end title for Fifty Shades of Grey.

But just because you have a meeting with a film executive and they ask you to submit a song, it is rarely if ever is a shoo-in.

"How many times are there cattle calls in this town where everyone and their brother says, 'Write me a song for this movie' and two or three-hundred songs are submitted and it goes nowhere," Moccio asks rhetorically. "And I can spend up to a month and half working on just one song to make sure it sounds great. That's what I did with Skylar Grey," he adds, referring to their gorgeous and haunting ballad "I Know You."

"It's not that common to find someone who has the musical skills Stephan has as well as songwriting and composing capabilities," says Grey, the 28-year-old songwriter and pop star who is in the back of a New York City cab with her manager Todd Mandel. "Usually it's either one or the other. I've written with quite a few people and it's refreshing to get in a room with someone who is an actual musician, who can actually bust out constant ideas on the spot like that."

But how does one compose a song that can possibly live up the carnal hype that preceded Fifty Shades without sounding contrived or treacle? "We tried to be a bit more emotional about it instead of focusing on the sex," says Grey. "We both read the book and then we got together and talked about the themes and the different places in the story we felt like we should try writing for. We started out by just trying to get the mood and the emotion and him playing chords and singing melodies and being like 'Yeah that feels right.'"

For nearly a year, Grey and Moccio's "I Know You" was slated to be the Fifty Shades end title. "It was one of the first songs more or less loved by all,' Moccio says, "at least by the studio, Erika [E.L. James]. the author, and Sam [Taylor-Johnson] the director. They were temping the movie and trying it out in various scenes. Around October 2014, they called me in and showed me the end credit and it played out beautifully. It was exactly what we were hoping for."

The song topped the iTunes chart the day it was released.

But nothing in the music placement business is ever guaranteed. "They did various screenings, and I think after a lot of thought they decided to change the ending of the movie ever so slightly," Moccio says, "but it meant that Sam was set on having a male vocalist. It didn't matter how incredible the song was."

The 'Fifty Shades of Grey' Soundtrack Hits Hard Enough to Leave a Lasting Mark

In November, as luck would have it, Moccio began work with The Weeknd just as the film's new closing scene was finished.

"We demoed it in a week or 10 days later in the studio," the composer says. "In early December I went to a scoring session with Sam Taylor-Johnson, Mike Knobloch, Rachel Levy [VP of film music at Universal Pictures], [music supervisor] Dana Sano -- everyone involved with music was there. ... We played it and Sam said, 'That's it, that's the end credit.'"

"It was the most incredible thing I've ever seen," says UMPG's Lamberg. "Me getting a call saying, 'You're not going to believe this: Remember we had one song and then we had none, now we got two!' He knocked himself out with a song he wrote and that one goes in to slot it."

In an email to Billboard following his performance with Moccio on Fallon, The Weeknd is sincere in his plaudits of Moccio. "The mix between my writing and his production skills brought 'Earned It' to life and birthed a very strong musical relationship. I'm excited to have him work on my upcoming album."

While Moccio may not yet be the pop-hit machine his publisher is convinced he will be, with possible upcoming projects and sessions with Seal and Trevor Horn, Alex Da Kid, Ellie Goulding, Demi Lovato, Kendrick Lamar and Nick Jonas, it may not be very long until he is.

"I came to Los Angeles because this town offers everything," Moccio says. "If you want to write a pop song, you can do that. Wanna write a score to a movie? You can do that. I always knew L.A. was the right fit. It's like walking into a toy store for me. There's a lot of incredible talent and there's a lot of things to do for a guy like me."