This paper proposes a music emotion recognition algorithm consisting of a kernel-based class separability (KBCS) feature selection method, a nonparametric weighted feature extraction (NWFE) feature extraction method, and a hierarchical support vector machines (SVMs) classifier to recognize four types of music emotion. For each music sample, a total of 35 features from dynamic, rhythm, pitch, and timbre of music were generated from music audio recordings. With the extracted features via feature selection and extraction methods, hierarchical SVM-based classifiers are then utilized to recognize four types of music emotion including happy, tensional, sad and peaceful. The performance of the proposed algorithm was evaluated by two datasets with a total of 219 classical music samples. In the first dataset, music emotion of each sample was annotated by recruited subjects, while the second dataset was labelled by music therapists. The two datasets were used to verify the perceived emotions from normal audience and music expert, respectively. The average accuracy of the proposed algorithm achieved at 86.94% and 92.33% for these two music datasets, respectively. The experimental results have successfully validated the effectiveness of the proposed music emotion recognition algorithm with hierarchical SVM-based classifiers.