A gunman walked down the middle of a street in the heart of Hollywood Friday, firing on passing cars and wounding a driver before police shot and killed him.

The man, who in video clips had short hair and wore jeans and a white tank top, was pronounced dead at the scene, Los Angeles police Officer Cleon Joseph said. No officers were hurt.

Oscar Herrera, a witness, said he saw the gunman walking down the middle of Vine Street near Sunset Boulevard, firing at least nine shots into the air and at passing cars while shouting "kill me" and "I'm gonna die!"

"People were running all over," Herrera told KABC-TV. "People was ducking."

But a man who captured video of the gunman from a window several stories above the street could also be heard on the recording screaming "shoot me," ''kill me" and "I'm gonna die."

Chris Johns, who filmed from his apartment, told KABC he was trying to distract and divert the gunman from shooting anyone on the street.

John said he saw a plainclothes officer shoot the man.

The 40-year-old male driver of a Mercedes-Benz was wounded in his upper body and taken to a hospital in unknown condition. A truck and another car were struck by bullets.

The gunman eventually ran out of ammunition and pulled a knife before a policeman fired at him four or five times, Herrera said.

He was a 26-year-old from Los Angeles, police spokeswoman Norma Eisenman said. Police said they aren't immediately releasing his name at his family's request until other family members could be contacted.

Dave Pepper told KCAL-TV that he was in his car when the gunman came at him.

"This guy came running across the street and he put the gun right up to this window," Pepper said as he sat in the car. "Why he didn't pull the trigger I don't know. ... I thought maybe he was out of bullets."

Investigators were trying to determine a motive for the attack. The area was cordoned off and the gunman lay under a white sheet in the street hours after the gunfire, leaving traffic tangled on busy Hollywood streets.

The area is packed with stores and restaurants, including the Cinerama Dome and Amoeba Records.

Some witnesses described the surreal incident as something that might have been staged on a movie location, a common sight around Los Angeles.

"When I heard it, I didn't react to it being real," said Greg Watkins, who was walking along the street when the shooting began.

"This is Hollywood, and they do film stuff all the time," Watkins told the Los Angeles Times. "I honestly thought they were filming something."