GUI Matlab Video Processing

3 次查看(过去 30 天)
Sevthia Nugraha
Sevthia Nugraha 2018-6-23
I got a problem in my final project. if we read frames in matlab gui 2015a, can we hear the audia too? i still can't hear the audio even my coding goes well. maybe, anyone knows?

回答(2 个)

Walter Roberson
Walter Roberson 2018-6-23

Sevthia Nugraha
Sevthia Nugraha 2018-7-15
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[chosenfile, chosenpath] = uigetfile('*.mp4', 'Select a video');
if ~ischar(chosenfile)
return; %user canceled dialog
end
filename = fullfile(chosenpath, chosenfile);
set(handles.edit50, 'String', filename);
% --- Executes on button press in Start Button.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filename = get(handles.edit50, 'String');
if ~exist(filename, 'file')
warndlg( 'Text in edit box is not the name of a file');
return
end
try
obj = VideoReader(filename);
catch
warndlg( 'File named in edit box does not appear to be a usable movie file');
return
end
axes1 = handles.axes1;
obj = VideoReader(filename);
while hasFrame(obj)
vidFrame = readFrame(obj);
image(vidFrame, 'Parent', axes1);
set(axes1, 'Visible', 'off');
pause(1/obj.FrameRate);
end
clear obj
i'm sorry that i can't open that website, so that's my code. and i still facing the problem with the sound. How can i get the sound of my file, Sir? Thank you

Community Treasure Hunt

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

Start Hunting!

Translated by