Pain or discomfort exposure during hospitalization of preterm infants has an adverse effect on brain development. Contactless monitoring has been considered to be a promising approach for detecting infant pain and discomfort moments continuously. In this study, our main objective is to develop an automated discomfort detection system based on video monitoring, allowing caregivers to provide timely and appropriate treatments. The system first employs the optical ow to estimate infant body motion trajectories across video frames. Following the movement estimation, Log Mel-spectrogram, Mel Frequency Cepstral Coefficients (MFCCs) and Spectral Subband Centroid Frequency (SSCF) features are calculated from the One-Dimensional (1D) motion signal. These features enable the representation of the 1D motion signals by Two-Dimensional (2D) time-frequency representations of the distribution of signal energy. Finally, deep Convolutional Neural Networks (CNNs) are applied on the 2D images for the binary - comfort/discomfort classification. The performance of the model is assessed using leave-one-infant- out cross-validation. Our algorithm was evaluated on a dataset containing 183 video segments recorded from 11 infants during 17 heel prick events, which is a pain stimulus associated with a routine care procedure. Experimental results showed an area under the receiver operating characteristic curve of 0.985 and an accuracy of 94.2%, which offers a promising possibility to deploy the proposed system in clinical practice.