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

Camera board • Re: Record video from two cameras simultaneously on Pi 5

$
0
0
Or if you want to use a Picamera2 solution try:-

Code:

#!/usr/bin/python3import timefrom picamera2 import Picamera2, Previewfrom picamera2.encoders import H264Encodercamera_a = Picamera2(0)camera_a.configure(camera_a.create_preview_configuration())camera_a.start_preview(Preview.QTGL, x=100,y=300,width=400,height=300)camera_b = Picamera2(1)camera_b.configure(camera_b.create_preview_configuration())camera_b.start_preview(Preview.QT, x=500,y=300,width=400,height=300)camera_a.start()camera_b.start()time.sleep(2)encodera = H264Encoder(1000000)encoderb = H264Encoder(1000000)camera_a.start_recording(encodera,"cam a record.h264")camera_b.start_recording(encoderb,"cam b record.h264")time.sleep(10)camera_a.stop_recording()camera_b.stop_recording()camera_a.stop_preview()camera_b.stop_preview()
With the bonus of getting both previews available :) .

If you're having diffficulty reviewing the .h264 files with the 'standard' VLC media player installing mpv player seems to be a good alternative.

Statistics: Posted by sandyol — Sat Jan 13, 2024 1:13 pm



Viewing all articles
Browse latest Browse all 3831

Trending Articles