double video player inside app

Hello everybody,
I have this problem:
I have to create a viewer for two synchronized videos from two gopro.
the aim is to be able to see frames by frames in order to be able to stop, to move one frame at a time so as to be able to identify the exact moment of a certain event.
my problem is that when I play two videos they are no longer synchronous and one goes faster than the other. how can I do? for now I have used these two solutions, both give me the same result and I don't know why!
Solution 1:
for i = 1:range
if app.Button_8.Value==0
app.Button_8.Icon='Play1.png';
break
end
app.Index_Video_Events=i;
gp1=[app.FrameGP1+i app.FrameGP2+i]
if app.AttivoGP1CheckBox.Value ==1 % play file video GP1
vidFrame_GP1=read(app.Video_Gopro1,app.FrameGP1+i);
imshow(vidFrame_GP1, 'Parent', app.UIAxes_3);
pause(0.01)
end
if app.AttivoGP2CheckBox.Value ==1 % play file video GP1
vidFrame_GP2=read(app.Video_Gopro2,app.FrameGP2+i);
imshow(vidFrame_GP2, 'Parent', app.UIAxes_4);
pause(0.01)
end
app.Slider_2.Value=app.Tap_Video_Start+app.Index_Video_Events;
end
end
Solution 2:
while hasFrame(app.Video_Gopro1)&&hasFrame(app.Video_Gopro2)
vidFrameGP1=readFrame(app.Video_Gopro1);
imshow(vidFrameGP1, 'Parent', app.UIAxes_3);
pause(1/framerate);
vidFrameGP2=readFrame(app.Video_Gopro2);
imshow(vidFrameGP2, 'Parent', app.UIAxes_4);
pause(1/framerate);
app.Slider_2.Value=app.numFrames+app.Tap_Video_Start;
app.numFrames = app.numFrames + 1;
if app.Button_8.Value==0
app.Button_8.Icon='Play1.png';
break
end
end

답변 (0개)

카테고리

질문:

2019년 12월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by