Early detection and prevention of stress is crucial because stress affects our vital signs like heart rate, blood pressure, skin temperature, respiratory rate, and heart rate variability. There are different ways to determine stress using different devices, such as the electrocardiogram (ECG), electrodermal activity (EDA), the electroencephalogram (EEG), photoplethysmography (PPG), or a questionnaire-based method of stress assessment. In this study, we proposed a camera-based real-time stress detection system using remote photoplethysmography (rPPG). We trained different machine learning models using three datasets: the SWELL dataset, the PPG sensor dataset, and the last ECG and EEG-based stress dataset. The models with the highest predictive accuracy were used to classify stress based on HR and HRV features obtained from the face using a camera. HR and HRV estimations from the face were validated on the PURE public dataset and the custom dataset. In this study, it was observed that the random forest algorithm performs significantly better than other models, achieving an impressive 99% predictive accuracy in the SWELL dataset. In the second dataset, the logistic regression technique shows the best result, achieving an accuracy rate of 84.24%. In the last dataset, the ensemble model achieved an accuracy rate of 67%. We also checked the proposed algorithm in the process of public speaking to estimate stress in a real-time situation.