Is it possible to view multiple videos at the same time (and being able to process it with custom code)?

조회 수: 2 (최근 30일)
figure(1)
movegui([0,300]);
figure(2)
movegui([700,300]);
vidObj = VideoReader('homer1.mp4');
vidObj2 = VideoReader('homer2.mp4');
while hasFrame(vidObj) && hasFrame(vidObj2)
vidFrame = readFrame(vidObj);
vidFrame2 = readFrame(vidObj2);
set(groot,'CurrentFigure',1);
imshow(vidFrame)
set(groot,'CurrentFigure',2)
imshow(vidFrame2)
end
I'd like to be able to read two video files, process them in real time and show them in seperate figures. The code above does not really work (I get the error message:"Error using VideoReader/initReader (line 734) Failed to initialize internal resources."), but I'm sure there are better methods to watch videos. What is the best way to show such videos (while they are processed)? I attached the video files to this question.
Thanks in advance

채택된 답변

Mahesh Taparia
Mahesh Taparia 2021년 10월 7일
편집: Mahesh Taparia 2021년 10월 7일
Hi
You can combine the frames of both the videos and visulaize them in loop using imshow function. For example, consider the below example:
v = VideoReader('xylophone.mp4');
while hasFrame(v)
frame = readFrame(v);
I = [frame frame];
imshow(I)
end
Hope it help!

추가 답변 (1개)

yanqi liu
yanqi liu 2021년 10월 8일
sir, please check the file homer2.mp4, may be some file broken happend.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by