Frequency/Signal of the pulsating light in a video

viki2000 used Ask the Experts™
I have a video with an LED pulsating on/off.
Just by looking with the naked eye I estimate the frequency somewhere in a visible spectrum 2-10Hz.
I would like to know with a higher precision the frequency.

Do you know any software for Windows or a trick/procedure how to find that frequency?
If I would be able to extract the signal on/off as a curve (rectangular signal) vs. time, that would be even better. It would be perfect.

What crossed to my mind up to now is only to split the videos in frames and to look how many frames are with LED on and how many with the LED off. Then knowing the frame rate I could calculate the frequency of the LED light or even to draw the signal. But that seems a Sisyphus work.
The problem is that frequency is not even constant.
There is also „flicker tester” software ( ). But I do not know if I can point that to my monitor, because the monitor has its own flicker frequency. I do not have access to the original light source. I have only a recorded video.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What is the duration of your video sample?  
Can you tell what the original frame rate was?
Is there any sort of image compression going on?  That might really mess things up.

Do you suspect the flickering is sinusoidal, rectified sinusoidal, or on/off?  If it is sinusoidal, you should be able to find the zero's pretty easily.

If you have access to software like Matlab, you could isolate the relevant pixels and plot their amplitude.  You could also use a small photo diode probe and plot the output on a scope.
In either case you might be able to run an FFT.
Do you see the video in the link above and as well in the attached zip?
It is around 4s.
I do not know the original frame rate, neither the compression, but I can try to find out.

I do not have access to Matlab and I am not use with it.
The LED light intensity is proportional with the current in LEDs. I only suppose the current is sinusoidal. I would like ti find that from the video.
I  was able to look at the file with the VLC Media Player.  This was one of the options that came up when I clicked on Open With.  I don't remember ever using this program, but I apparently installed it five years ago.

The file properties say the video is 25 frames per second.  I was able to slow it down by a factor of 30 and count the frames.  I counted 94.  The LED's seem fairly erratic.  Sometimes on for a single frame, sometimes for several.  You can also see several brightness levels.

If normal (unidirectional) LED's are connected to a magnetic pickup coil, I would expect them to be on less than half the time.  The coil will generate a voltage proportional to the change in magnetic field.
Current will flow when the voltage forward bias the diode and exceeds the turn-on threshold.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

It is erratic indeed. Seems so.
I expect to be sinus current through the LEDs, from here the variation of intensity, but then there are breaks, time off moments between sine wave pulses.
I would like to reconstruct the current waveform.
Assuming that part with sine is too difficult, it would be enough to know the time on and time off intervals. Then I can see the frequency.

I was thinking that maybe there is a piece of video analyzing software that maybe can do that or at least a part of the job, that's why I asked here.

One idea that you suggested, using a photo-sensor and an oscilloscope is not so bad, but involves one steady point on the screen. The LEDs from video are moving according with the camera motion which was held in hand. So to apply your idea, I need next video fix: how to apply a video motion filter/transformation (what program) in such way that an object in motion will become steady still? I think this would an interesting problem and maybe I should open a new question special only for it.

Other video analyses software to help me I do not know. Can you do something in Matlab?
Any other, more accessible software, solution?

In mean time I extracted all the frames.
There are 123 frames with 25 frame/s frame rate:

After Effects has a Warp Stabilizer without manual motion tracking.
The attached zip shows the result.
Now that the image is stabilized is easier to focus only on one region and extract the brightness/luminance levels for each frame.

Here is what you proposed:
but I do not have Matlab and I do not work with it.

Here is something similar that I would like to have as end results:

It seems that are functions/programs with filters/plugins named "videoscope" or "vectorscope" that can do that, but all seem to do it on the entire screen and not on a certain region:

The worst case is to use a picture editor and use the color picker for each 123 picture-frames and see the level of white, luminance.
For example Gimp can make a mean value of a region:
But then it would be nice a batch processing and not manually look for each picture-frame.
Test Gear 2.5 pulgin  from Synthetic Aperture for After Effects lets you see the waveform of luminance, but I have no idea about timing.
What you see below is from one frame.
Here is the test with my 1st idea.
I opened the video in frames.
Then I used a program
In 10 min I was able to pick-up manual the RGB of the middle LED from all frames and a list was generated. It would have been nice an automated batch process a single piece of software...
Using the next formulas:
I calculated the gray-scale, brightness and I plotted over the time knowing that the video was 25 frame/s, meaning 1 frame each 40ms.
The result is in the Excel below.
It seems around 200ms-400ms period for the siganl, so a 2.5Hz-5Hz frequency.

It remain only one thing to consider: the interference and the sampling rate (frame rate) of the digital camera vs. the LED pulsating light. Maybe some pulses are missing or there is a total interference, hard to say.


I ran a second test, this time a bit automated using mouse recorder software accelerates the tasks a bit ( ).
I focused this time on lightness (HSL) 
The results are very similar.

You are way ahead of me.  I managed to read the video into Matlab then got stuck on the learning curve.
The VLC program said the frame rate was 25 per second.  I don't know if this is embedded info or a default.
I could easily believe you have a sinusoidal signal with some saturation and rectification.
I want to conclude few things:
- forget for a moment about the current waveform in the LED and consider only on/off, meaning max. brightness of the LED in the center of LED when is ON and the gray level when is OFF. That is enough to find the pulsating frequency.
- I find the result and entire analysis irrelevant now. The reason comes from DSO way of working or general from a DAQ. In order to see/acquire correctly a signal we must have the sampling rate higher than the signal. There is a theorem saying that must be at least 2 times higher, but in reality that makes from a sine a triangle, so we need in fact at least 10 times higher to reconstruct the initial signal with a good/acceptable approximation. Higher is even better. This applies also to our case. If the LED flashes with low frequency in reality, let's say 400ms period, as I calculated, and the frame rate is 25 frame/s, meaning 1 frame each 40ms, that is acceptable because the sampling rate is 10 times higher. But how do I know that for sure? I do not have access to original video. If the frequency of the LED is higher, multiple of 40ms, then the frame rate, sampling rate of the digital camera catches only some of the pulses, missing some, and everything is then wrong. On the other hand that is less probable because it needs a synchronization between camera frame rate and pulsing moments.
It is a strange and difficult to analyze problem if we do not know more info about original video.
But was also interesting.

Thank you for your suggestions and your time. Sometimes brainstorming or only another person to speak with is enough for me. It just make me going further. I think I will close the question now.

P.S. If you want to play further in Matlab it would be interesting to see the outcome. The 25 fps is defined in video, inside. I can see that with any video editing software that I used. That's why when I extracted all the frames, it was clear how many I have, because is the length of the video multiplied with the frame rate.
I tried FFT and I got around 4.5Hz for the slowest blinking and around 20.5Hz for highest rate blinking.
I used Excel, Analysis Pack as explained here:
FFT Excel
Then I tried Sigview trial software. The units on the axis are not proper.
SignalFFT barsFFT curve
I tried also DaDisp free student, but I could not get the FFT proper, I miss a setting somewhere.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial