A 21-year-old who stood in front of a train as he played "chicken" on a level crossing has appeared in court.
Andrew Ogden was crossing the line near Chorley, Lancashire, on 14 July when he stopped on the tracks.
The driver braked and sounded his horn before Ogden jumped aside with only seconds to spare. The driver, believing he had hit him, stopped down the line.
Ogden appeared before Chorley Magistrates Court where he pleaded guilty to obstructing a train.
His defence solicitor said he thought at the time it was going to be "a bit of a laugh" for his friends.
He is due to be sentenced at Preston Crown Court on 7 January.