Updated

The last night of Xinran Ji's life can be told in the videos that tracked the Chinese graduate student from the time he left his apartment to study with other students at the University of Southern California until he returned home hours later covered in blood.

In between those still frames taken outside his apartment, police found two cameras that captured footage of a group of teens attacking him as he walked home from school early the morning of July 24.

The footage was shown Tuesday in Los Angeles Superior Court as a prosecutor made his case for trying three teens for murder in the incident that raised concerns in China about the safety of students abroad and refocused criticisms about security at USC.

Details were murky in the black and white surveillance videos, but they showed Ji being surrounded by a group of people on a dark street and then, in a subsequent video, being chased as he ran for his life.

"You can just see a scrum, it looks like," Deputy District Attorney John McKinney said during a break in court, describing one of the videos.

Authorities say Jonathan Del Carmen, 19; Alberto Ochoa, 17; and Alejandra Guerrero, 16, were trying to rob Ji, 24, when he was beaten with a bat and wrench and left for dead.

A fourth defendant, Andrew Garcia, 19, is charged, but his hearing was postponed because his lawyer was ill and another defense attorney raised questions about his mental competency. Garcia blurted out obscenities in court Monday.

All four have pleaded not guilty and are being held without bail. Del Carmen and Garcia could face the death penalty if convicted. Ochoa and Guerrero are charged as adults, but they can only face up to life in prison without the possibility of parole if convicted because of their ages.

The preliminary hearing that continues Wednesday included a witness who testified about being robbed by three of the defendants about an hour after Ji's killing.

But the brunt of testimony focused on videos and a trail of blood that led from Ji's apartment to two street locations where the confrontation footage was shot.

Ji managed to make it home, where he was found dead in bed later that morning.

Ji's roommate said she awoke around 3 a.m. and heard sniffling, but thought Ji had a cold, so she went back to sleep, Detective Matthew Courtney testified. When she emerged from her room four hours later, she found blood stains and Ji unresponsive and covered in bloody clothing.

Courtney and his partner tracked the bloody trail down the street and around the corner, where they eventually found a pair of broken glasses.

The detective and other officers went to USC and several other private building owners to gather at least seven videos that showed the attack on Ji or his alleged assailants driving through the neighborhood before or after the crime.

Cameras have become a ubiquitous witness to life around the campus that sits on the edge of downtown Los Angeles and borders neighborhoods with historically high crime. The school and Los Angeles police beefed up security measures, including more patrols on and around campus, after two Chinese graduate students were murdered outside an off-campus apartment in 2012.

Video from the location where Ji was first attacked showed a car pull to the side of the road and a group of people surround him in the street. McKinney said one of the men can be seen hitting Ji with a bat.

The student is able to get away, and a second camera caught him as he turned a corner with two others running after him, followed by a car.

The second video lasts longer, but most of the action is obscured until Ji stumbles to his feet and leans on a car for a few seconds. McKinney said Ji bled the most at that location.

He bled the whole way home, arriving at his front door at 12:48 a.m., where the white T-shirt he was seen leaving in appeared covered in blood.