Hi everyone. I have a large number of video files to process. What I want to do is extract parts from each video file. For example if I have a 10 minute Video, I want to cut away everything, so that I'm just left with for example minute 5 to 6, and save this as a new video file, with both video and audio!!!
What I did so far is read in the original Video File, split it up into Frames, select the specific frames, and save them as a new file, but that leaves me with no audio.
how can I get the audio as well? or is there possibly an easier way? some already existing function?
Thank you very much!
My code so far:
function [] = extractscene(nameOfFile, beginTime, endTime, SceneClassifier) inputName = strcat(nameOfFile,'.mp4');outputName = strcat(nameOfFile,'_',num2str(SceneClassifier),'_',num2str(beginTime),'_',num2str(endTime),'.avi');a = VideoReader(inputName);beginFrame = beginTime * a.FrameRate;endFrame = endTime * a.FrameRate;vidObj = VideoWriter(outputName);open(vidObj);for img = beginFrame:endFrame b = read(a, img); writeVideo(vidObj,b)endclose(vidObj);
Best Answer