Page 1 of 1

2018-03-13-raspbian "raspivid --mode 7" can do up to 200fps!

Posted: Sun Mar 25, 2018 12:17 pm
by HermannSW
raspivid was restricted to 120fps (although documentation says 90fps) for mode 7 (640x480).

@6by9 did relax that after I demonstrated that the GPU can process even 180fps 640x480 videos without issues (with a hack, injecting my own I2C commands to camera at 5th frame of video having already started). So since quite some time you were able to capture mode 7 videos with up to 200fps, when you did "sudo rpi-update" as described here (nice 180fps video from driving train there):

After I got my new Pi 3B+ I did install newest Raspbian the first time, and it has the ability for capturing up to 200fps videos as well.

Yesterday I did play with a 6$ 5000lm LED light, but the rolling shutter effect of my smartphone camera did show that direct connection of mains electricity works, but suffers from German(European) 50Hz power line frequency:

So I took a 150fps video with my v2 camera:

It looks sharp because I removed the original v2 camera lens and added a M12 mount and a f6.0mm 65° lens:

With 50Hz power line frequency the light has maximal brightness 2*50 times per second.
At 150fps video this leeads to a repeating pattern (lcm = least common multiple) every 3rd frame:

Code: Select all

lcm(150, 2*50)/(2*50) = 300 / 100 = 3

Here you can see in animated .gif generated:

I took the video with this command that took microsecond resolution timestamps as well:

Code: Select all

raspivid --mode 7 -w 640 -h 480 -fps 150 -t 5000 -pts test.pts -o test.h264

This tool can be used to analyze the generated timestamp file for frame delay distribution and frame skip determination: ... ptsanalyze

I use it for the hacked raspivid with injected I2C commands, and it needs as 2nd argument a frame number.
You can safely pass "1" for normal videos taken with new Stretch raspivid:

Code: Select all

[email protected]:~ $ ./ptsanalyze test.pts 1
creating tstamps.csv
728 frames were captured at 150fps
frame delta time[us] distribution
      1 6635
      1 6636
      2 6637
      2 6638
     20 6639
    293 6640
    370 6641
     29 6642
      3 6643
      2 6644
      1 6646
      1 6647
after skip frame indices (middle column)
0 frame skips (0%)
[email protected]:~ $ 

As you can see there are no frame skips in the video I recorded, and frame delta time is 6641μs ± 6μs.

Re: 2018-03-13-raspbian "raspivid --mode 7" can do up to 200fps!

Posted: Sun Apr 29, 2018 3:26 pm
by HermannSW
I did order another 5000lm light, this time with LED Driver.
I measured 48V DC without load, not sure how that relates to "DC:22-38V" on driver label:
And really all the power line frequency issues are gone by DC powering the light.

I did take another 150fps video of new light as described in previous posting.
Three frame skips, 723 frames in total, 150.17fps on average.

Interesting to see that GPU Automatic White Balancing needs 1.5s to adjust to 5000lm turned on ;-)
Here is the uploaded youtube video, 150fps played at 30fps, 5 times slower than real:

I used the technique from "Howto upload raspivid high framerate videos to youtube" posting to add millisecond resolution timeoverlay:

This is frame just before turning on 5000lm light, 784ms:

Next frame, partial 5000lm effect, 790ms:

Next frame, nearly white, 797ms:

Frame at 2364ms, AWB completed:

I did screw the 5000lm light on a small wooden bar for easier fixation in Realacc arm:

Re: 2018-03-13-raspbian "raspivid --mode 7" can do up to 200fps!

Posted: Sun Apr 29, 2018 5:08 pm
by ejolson
Thanks for posting. These are very interesting experiments that are as much about hardware as software. I suspecta higher-speed camera like that could be effective for taking measurements in many different science experiments.

Re: 2018-03-13-raspbian "raspivid --mode 7" can do up to 200fps!

Posted: Sun Apr 29, 2018 5:38 pm
by HermannSW
ejolson wrote:
Sun Apr 29, 2018 5:08 pm
I suspecta higher-speed camera like that could be effective for taking measurements in many different science experiments.

raspivid max framerate is limited to 200fps because Raspberry GPU breaks at 202fps. But with raspiraw you can do much higher framerates, my favorite v1 camera mode is 640x128_s at 665fps(!).

Few days ago I brought v2 camera to the max, it can do 1007fps (640x75 sofar, will do 640x150_s soon)
This is first 1007fps video I took, played at 30fps, 33.5 times slower than real)

For sharp view of high speed scenes shutter time has to be very small.
1.6ms in this 665fps mouse trap video frame is too high
(the moving bar did hit piezo igniter on right as can be seen by spark in middle, but you cannot see that)

Typically photos and videos get dark with such short shutter times, but bringing in bright light compensates for that. I am lucky that the new 5000lm light has no issues, brightest light I had sofar was 1000lm.

See also thread "v2 camera can capture 1000fps videos ...":