User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

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

Sun Mar 25, 2018 12:17 pm

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):
viewtopic.php?f=43&t=206047&p=1285069#p1285069

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:
Image

So I took a 150fps video with my v2 camera:
https://www.youtube.com/watch?v=jmd0ntmJJUk

It looks sharp because I removed the original v2 camera lens and added a M12 mount and a f6.0mm 65° lens:
viewtopic.php?f=43&t=45887&p=1290678#p1290678

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:
Image


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:
https://raw.githubusercontent.com/Herma ... 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.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

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

Sun Apr 29, 2018 3:26 pm

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:
https://twitter.com/HermannSW/status/980729703899246592
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:
https://www.youtube.com/watch?v=FVpvAJeazRA


I used the technique from "Howto upload raspivid high framerate videos to youtube" posting to add millisecond resolution timeoverlay:
viewtopic.php?t=209794


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



Next frame, partial 5000lm effect, 790ms:
Image



Next frame, nearly white, 797ms:
Image



Frame at 2364ms, AWB completed:
Image


I did screw the 5000lm light on a small wooden bar for easier fixation in Realacc arm:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

ejolson
Posts: 3251
Joined: Tue Mar 18, 2014 11:47 am

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

Sun Apr 29, 2018 5:08 pm

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.

User avatar
HermannSW
Posts: 1319
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

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

Sun Apr 29, 2018 5:38 pm

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.
Agreed.

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)
viewtopic.php?f=43&t=109137&p=1307795#p1307795
This is first 1007fps video I took, played at 30fps, 33.5 times slower than real)
Image


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)
Image


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.

P.S
See also thread "v2 camera can capture 1000fps videos ...":
viewtopic.php?f=43&t=212518
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Return to “Raspbian”