Network Rail have issued a warning after children were caught taking a selfie on the railway line in Halifax.
Children have also been filmed on the tracks in Shipley throwing stones at the overhead lines.
There were more than 900 instances of trespass on the railway in Yorkshire last year.
The footage has been released by Network Rail, British Transport Police (BTP) and Northern to coincide with the launch of a campaign to tackle the issue of trespass on the railway.
The campaign aims to raise awareness of the dangers of trespassing on the railway and implores young people not risk their lives on the tracks, as well as encouraging parents to instil these warnings into their children.
Hayley Bull, community safety manager at Network Rail, said: “The footage is absolutely shocking; young people in particular need to realise that they are risking their lives when they choose to trespass on the railway.
We invest lots of time and money into keeping people safe on the railway but we need users to do their bit too. It may seem harmless to take a shortcut, or fun to play on the tracks, but this is not only illegal, it is also very dangerous. Taking a short cut or messing around on the tracks can result in serious life-changing injuries or death.
Chief Inspector Lorna McEwan from BTP in Leeds said: “We believe the number of children we encounter trespassing every year is sadly just the tip of the iceberg
“Every single day we are called to the tracks to incidents similar to those captured in the footage, Train drivers regularly have to sound their horn or apply their emergency brake In a desperate bid to avoid youths on the line, who then run off, seemingly unaware of the danger they have put themselves in.
We continue to do all we can to keep youngsters safe by patrolling areas where we know they’re likely to trespass and prevent them from doing so.