I have some videos suppose 10 in number like 1.avi, 2.avi,…,9.avi,10.avi. I am reading those videos, then extracting their frames and then doing some processing on the frames using a for loop. Using these processed frames of the input videos, I want to write these 10 videos (these will be containing the processed frames) again with the name out1.avi, out2.avi,…, out9.avi,out10.avi. I am trying to write the videos using VideoWriter object but it is not changing with every loop. How can I get these outputs? For eg. I am writing this piece of code. In Folder I have 10 videos. I want to write output videos similarly in an other folder.
clc;clear all;close all;Folder='/media/splab1/HDD_P21/codes/ISOGD/train';s=dir(Folder);for m=003:length(s) vid=VideoReader(fullfile(Folder)); numframe=vid.NumberOfFrames; for iFrame = 1:1:numframe frames = read(vid, iFrame); img1=rgb2lab(frames); outputVideo = VideoWriter('m.avi'); outputVideo.FrameRate = vid.FrameRate; open(outputVideo); writeVideo(outputVideo,img1); close(outputVideo) endend
If the question is not clear, feel free to comment.
Best Answer