Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different format of video will get different result? #3

Open
sjz123321 opened this issue Jun 14, 2020 · 2 comments
Open

Different format of video will get different result? #3

sjz123321 opened this issue Jun 14, 2020 · 2 comments

Comments

@sjz123321
Copy link

I used ffmpeg to convert the video format from .mkv to .avi .mp4 .mov Three types of videos got different results. And it happened on another video too. So I modified the heartrate.py

add : print("peak is: ",peak,"hight is: ",fft_maximums[peak],"In this case HR is: ",freqs[peak]*60)

video.mp4
peak is: 12 hight is: 2.968162773664705 In this case HR is: 71.70124481327802
peak is: 14 hight is: 2.600039322516675 In this case HR is: 83.65145228215769

video.avi
peak is: 10 hight is: 3.3830124388984726 In this case HR is: 60.0
peak is: 14 hight is: 2.704215718114888 In this case HR is: 84.00000000000001
peak is: 16 hight is: 2.337397877666178 In this case HR is: 96.0

video.mov
peak is: 12 hight is: 2.968162773664705 In this case HR is: 71.70124481327802
peak is: 14 hight is: 2.600039322516675 In this case HR is: 83.65145228215769

same as video.mp4

It seemed mp4 mov format is a good choice.

but when I use mp4 file (record by my mobile phone) error occurred

Traceback (most recent call last):
File "C:\Users\94047\Desktop\eulerian-remote-heartrate-detection-master\main.py", line 39, in
print("Heart rate: ", heart_rate, "bpm")

@aminrezaei-img
Copy link

I used ffmpeg to convert the video format from .mkv to .avi .mp4 .mov Three types of videos got different results. And it happened on another video too. So I modified the heartrate.py

add : print("peak is: ",peak,"hight is: ",fft_maximums[peak],"In this case HR is: ",freqs[peak]*60)

video.mp4 peak is: 12 hight is: 2.968162773664705 In this case HR is: 71.70124481327802 peak is: 14 hight is: 2.600039322516675 In this case HR is: 83.65145228215769

video.avi peak is: 10 hight is: 3.3830124388984726 In this case HR is: 60.0 peak is: 14 hight is: 2.704215718114888 In this case HR is: 84.00000000000001 peak is: 16 hight is: 2.337397877666178 In this case HR is: 96.0

video.mov peak is: 12 hight is: 2.968162773664705 In this case HR is: 71.70124481327802 peak is: 14 hight is: 2.600039322516675 In this case HR is: 83.65145228215769

same as video.mp4

It seemed mp4 mov format is a good choice.

but when I use mp4 file (record by my mobile phone) error occurred

Traceback (most recent call last): File "C:\Users\94047\Desktop\eulerian-remote-heartrate-detection-master\main.py", line 39, in print("Heart rate: ", heart_rate, "bpm")

I went nuts figuring this out, it also happened to me, would you please tell me what did you do with peak detection to get the right heart rate?
I used ffmpeg to prevent data loss, but when I load them, the FFT output is zero, but when I load the raw videos fft output is not zero, I would really appreciate any help or guidance.

@owais3901
Copy link

owais3901 commented Feb 24, 2023

@aminrezaei-img I think it's because of different codec i use "mp4v" codec with opencv and it's work without any error ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants