Interesting, I did grep for "pre_callback"in picamera2/examples, and timestamped_video.py was single hit.Mostly I would use the pre_callback for drawing on an image if you want the change to appear on images or videos that you capture and save. ... But the pre_callback is mostly just an easy way to do "something" on every frame without having to find another thread to put the code in. Such as logging for statistics or debugging, I generally wouldn't recommend doing "much" in the callback because you are directly in the camera loop.
After apt install of libopencv-dev and python3-opencv demo worked, saved 5s long video.
But not (timestamp) text wes written on test.h264 output, at least I was not able to see any text.
So I added output of dot for every call of pre_callback:
Code:
def apply_timestamp(request): timestamp = time.strftime("%Y-%m-%d %X")+ print(".",end="") with MappedArray(request, "main") as m: cv2.putText(m.array, timestamp, origin, font, scale, colour, thickness)
Code:
pi@raspberrypi5:~/picamera2/examples $ python timestamped_video.py ...[147:45:28.217028164] [78298] INFO RPI pisp.cpp:1450 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/imx296@1a - Selected sensor format: 1456x1088-SBGGR10_1X10 - Selected CFE format: 1456x1088-PC1B..............................................................................................................................................pi@raspberrypi5:~/picamera2/examples $
What am I missing?
Statistics: Posted by HermannSW — Thu Jun 27, 2024 10:02 am