Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6960

Camera board • Camera v3 on Raspi 02W videos are half the specified length

$
0
0
Hi all,

I film and upload the videos on headless raspberry pi zero 2W to google drive every day. I have found that my videos are half the length they should be (30 min), but thanks to the timestamp, I can tell that they contain the entire 30min of video. This happens even if I cut the length of the video to 30 sec, the video ends up being 15sec. I haven't run a specific frame rate test, but I can tell they are filming at about half the fps they should be (should be filming at 30, are actually filming around 14-15fps, I suspect). The script, called every day with crontab, and then I reboot the pi and midnight every night:

Code:

#!/usr/bin/python3from picamera2.encoders import H264Encoder, Qualityfrom picamera2 import Picamera2, MappedArrayimport timeimport datetime as dtimport osimport cv2from send2trash import send2trashfrom libcamera import controlspicam2 = Picamera2()picam2.configure(picam2.create_video_configuration())picam2.set_controls({'FrameRate': 30})#define filename as datestampfile_name = dt.datetime.now().strftime('%m-%d-%Y_piz3.h264')file_path = '/home/pi/'vidname = os.path.join(file_path, file_name)#define timestamp within the videocolour = (0, 255, 0)origin = (0, 30)font = cv2.FONT_HERSHEY_SIMPLEXscale = 1thickness = 2def apply_timestamp(request):        timestamp = time.strftime("%Y-%m-%d %X")        with MappedArray(request, "main") as m:                cv2.putText(m.array, timestamp, origin, font, scale, colour, th>picam2.pre_callback = apply_timestamp#enable encoderencoder = H264Encoder(10000000)picam2.start_recording(encoder, vidname)print('recording')time.sleep(1800) #change this to the length of your videopicam2.stop_recording()print('uploading')os.system('rclone sync /home/pi/*.h264 gdmedia:aggression_development_assay_test')send2trash(vidname)
I've been looking around at a few topics related to this and have had zero luck fixing this problem. Tried setting force_turbo=1 as specified with this post , and tried specifying fps as listed here. Neither worked. If someone has a solution in picamera2, I also saw advice to switch to libcam-vid, but I know no c, so haven't been able to try it out.

Running Camera v3 on a raspi 02W with rasbian 12 (bookworm). I've got an identical hardware set-up running on rasbain 11 (bullseye) that do not have this issue. If there isn't a good fix, I can downgrade the bookworm pis back to bullseye, but I'd like to stay in bullseye if I can.

Also here to help troubleshoot, the libcamera terminal output when I call the script. There's a warning that the camera is using legacy SDN tuning; not sure if this is relevant to the problem. Any help would be massively appreciated. Thanks all!

Code:

[0:04:02.905449857] [1529]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d[0:04:03.359217348] [1532]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:04:03.377205891] [1532]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0[0:04:03.389312584] [1532]  INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'[0:04:03.427956604] [1529]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d[0:04:03.829088648] [1535]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:04:03.850592116] [1535]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0[0:04:03.851714088] [1535]  INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'[0:04:04.013075094] [1529]  INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-XBGR8888 (1) 1536x864-SBGGR10_CSI2P[0:04:04.022210868] [1535]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA

Statistics: Posted by moelwe — Fri Jun 14, 2024 8:23 pm — Replies 1 — Views 32



Viewing all articles
Browse latest Browse all 6960

Trending Articles