A former Sun Prairie middle school band teacher was sentenced to 14 years in federal prison Thursday for videotaping his former students while they were in the bathroom at the school.