Footage from the inside of a southern California bar showing a gunman carrying out a mass shooting has been released by a survivor of the attack.

Gunfire can be heard ringing through the Borderline Bar and Grill in Thousand Oaks in the video, filmed during the shooting on Wednesday evening that left 12 people dead.

Marine veteran Ian David Long, 28, opened fire in the packed bar before turning his gun on himself, law enforcement officials have said.

Footage from inside the building, captured by survivor Dallas Knapp, shows the silhouette of the gunman stalking through the room before several gunshots are heard.

Mr Knapp released the mobile phone video he had taken during the shooting on Friday, revealing he had lost friends in the attack in a post on Instagram.

“I looked him in his eyes while he killed my friends I hope he rots in hell for eternity,” he wrote. “The guy you see is the murderer and the shots are him shooting people trying to get out the windows.”

As the gunman moves out of sight in the footage, Mr Knapp uses the opportunity to sprint out of the bar to safety, warning others in the vicinity in a panicked tone: “Guys, run, he’s coming out this door."

The massacre in Thousand Oaks, a suburb around 40 miles northwest of downtown Los Angeles, is the latest shooting rampage in the US, coming just two weeks after 11 worshippers were killed at a Pittsburgh synagogue.

Paul Delacourt, assistant director in charge of the FBI's LA office, said it was too early to speculate on the shooter's motives but he appeared to have acted alone.

“We will be sure to paint a picture of the state of mind of the subject and do our best to identify a motivation,” Mr Delacourt said, adding the FBI would investigate any possible “radicalisation” or links to militant groups.

Support free-thinking journalism and attend Independent events

Long fired seemingly at random inside the Western-themed bar with a .45 calibre Glock handgun equipped with a high-capacity magazine, Ventura County Sheriff Geoff Dean said.

The suspected shooter served in the Marine Corps from 2008 to 2013, completing a tour of duty as a machine gunner in Afghanistan.

Sheriff Dean suggested the Long may have suffered from post-traumatic stress disorder.

California Lutheran University, which just the day before cancelled classes because many of its students frequented the Borderline bar, announced it would close Friday and was “monitoring the situation closely.”