The last installment in the Hobbit trilogy is set for release in the coming weeks, and the theme song has just gone online.

'The Last Goodbye' was written and performed by actor Billy Boyd, who played the hobbit Pippin Took in the Lord of the Rings trilogy. It will play over the end credits of 'The Hobbit: The Battle of the Five Armies'.

Boyd follows in the footsteps of Ed Sheeran, whose song 'I See Fire' played over the credits 'The Hobbit: The Desolation of Smaug', and Crowded House frontman Neil Finn, whose 'Song of the Lonely Mountain' was used in 'The Hobbit: An Unexpected Journey'.

You can watch the video for 'The Last Goodbye' below: