In a sequence of postings 6by9 helped me to increase "raspiraw" capturing framerate for 640x480 from 60fps to 90fps. Then I found out later how to do 180fps (640x240), 360fps (640x120) [all for Pi Zero as well as for Pi 2B] and 480fps (640x60) [only Pi 2B].
My main target for these (surprisingly) high framerates is to use them for high speed robot control (no need to store frames for that application). If my robot will run at target speed of 5m/s, then a 90fps raspiraw modification will give me a frame every 5.6cm only. At 360fps callback will be called every 1.4cm.
I created a separate thread for this type of (raspiraw) application. This posting describes raspiraw modification (with 60fps mode raspiraw at that time) for automatic caterpillar robot camera tilt calibration (should complete 6 times faster when done with 360fps mode raspiraw):
viewtopic.php?f=43&t=189661#p1231151

This thread is on the other type of application with high framerate raspiraw video capturing, generation of high framerate videos. By default raspiraw saverate is 20. That means that only every 20th frame gets stored to (slow) SD card. I found a nice method to circumvent the SD card low speed for recording high framerate videos:
viewtopic.php?f=43&t=109137&start=275#p1240536
The trick is to store under "/dev/shm" ramdisk, and that allows for raspiraw saverate of 1 (all frames get stored)! The size of /dev/shm filesystem allows to store 4s of high framerate video on a Pi Zero (at 90fps, 180fps or 360fps) and up to 9s of high framerate video on a Pi 2B (at 90fps, 180fps, 360fps and even 480fps).
These are the new modes I plan to provide shortly as addons to raspiraw "ov5647_modes.h":
viewtopic.php?f=43&t=109137&start=300#p1242300

"raspiraw" stores "raw Bayer" format individual frames received as is from camera via CSI-2 interface (each 2x2 square consists of BG/GR pixels: Red, Green and Blue):

These can be converted to visible .ppm format frames by a version of "dcraw" patched by 6by9.:
viewtopic.php?f=43&t=109137#p750763
Later there will be some script that creates videos from the taken single frames by "gstreamer multifilesrc" or similar. Here I want to describe the poor man's solution I used today to create this 360fps animated.gif, rescaled from 640x120 (with 2x vertical stepping), with slowdown play factor 25:

I hereby confirm that my finger that I moved quickly before the Pi Zero is NOT transparent

1) capture the video (3s at 360fps is 1080 frames, confirmed by 3rd command):
Code: Select all
pi@raspberrypi2B:~/userland-rawcam $ rm /dev/shm/out.*
pi@raspberrypi2B:~/userland-rawcam $ time ( raspiraw -md 9 -hd -t 3000 -sr 1 -o /dev/shm/out.%03d.raw 2>err >out )
real 0m3.088s
user 0m0.200s
sys 0m1.000s
pi@raspberrypi2B:~/userland-rawcam $ ll /dev/shm/out* | wc
1081 9729 64942
pi@raspberrypi2B:~/userland-rawcam $
2) copy 20 frames off "/dev/shm" and convert to .ppm (Portable PixMap format) using "dcraw":
Code: Select all
pi@raspberrypi2B:~/userland-rawcam $ for((i=130; i<150; ++i)); do cp /dev/shm/out.$i.raw .; dcraw out.$i.raw; echo $i; done
130
131
...
...
148
149
pi@raspberrypi2B:~/userland-rawcam $
3) inspect images with eg. "eog" slideshow, this is a single 640x120 frame:

4) Stretch frames vertically 2x by my own small "double.c" (to be sure what happens):
https://stamm-wilbrandt.de/en/forum/double.c
Code: Select all
$ for((i=130; i<150; ++i)); do ./double out.$i.ppm > do/out2.$i.ppm; echo $i; done
130
131
...
...
148
149
$

5) Convert frames via "ppmquant 256" and "ppmtogif":
Code: Select all
for((i=130; i<150; ++i)); do ppmquant 256 do/out2.$i.ppm | ppmtogif > out2.$i.gif; echo $i; done
pnmcolormap: making histogram...
...
...
pamtogif: 255 colors found
149
$
6) Finally create looping animated .gif with 0.07s delay between frames (25x slowdown of 360fps):
Code: Select all
$ gifsicle --colors 256 -l -d 7 out2.*.gif -o out.360fps.25xSlower.anim.gif
$
As said, this is poor man's solution for now, just wanted to get it written down ...
P.S:
The Pi 2B or Pi 3B can capture 640x128 video with 600fps !!
viewtopic.php?f=43&t=109137&p=1243092#p1243092
