Recording simultaneous video from 2 cameras
조회 수: 6 (최근 30일)
이전 댓글 표시
For a project i need to record 2 IP cam video streams and wonder on how to accomplish that since the image aquisition explorer only allows me to use one camera at a time.
Cheers!
댓글 수: 0
답변 (1개)
Saffan
2023년 10월 30일
Hi Frederik,
I understand that your goal is to simultaneously record two video streams from two separate IP cameras. This can be achieved using the “ipcam” function, which facilitates the acquisition of video data from IP cameras.
Here is a code snippet that demonstrates this:
% Create the ipcam objects
cam1 = ipcam('address1');
cam2 = ipcam('address2');
% Capture one frame to get its size
frame1 = snapshot(cam1);
frame2 = snapshot(cam2);
[frameHeight1, frameWidth1, ~] = size(frame1);
[frameHeight2, frameWidth2, ~] = size(frame2);
% Create video writer objects
outputVideo1 = VideoWriter('cam1.avi');
outputVideo2 = VideoWriter('cam2.avi');
open(outputVideo1);
open(outputVideo2);
duration = 100;
tic;
while toc < duration
writeVideo(outputVideo1, snapshot(cam1));
writeVideo(outputVideo2, snapshot(cam2));
end
% Close the video writer objects
close(outputVideo1);
close(outputVideo2);
Please refer to the following documentation for more information:
Hope this helps!
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!