I am new to MATLAB. I am trying to encrypt video file in MATLAB. I encrypted the individual frame of video. I am using MATLAB 7.10.0 (R2010a) , that's why I used "mmreader" fumction. But now I am not getting how to reassemble all the encrypted frames into a new video. here is my code,
vid = mmreader('videoSampl.avi');
numFrame = vid.NumberOfframes;
for i = 1:2:3
frame = read(vid, i);
gray = rgb2gray(frame);
n = numel(gray);
plaintext = reshape(gray, n, 1);
cipherImg = cipher (plaintext, w, s_box, poly_mat, 1);
re_plaintext = inv_cipher (cipherImg, plaintext, w, inv_s_box, inv_poly_mat, 1);
img = reshape(cipherImg, 128, 128);
imwrite(img,['videoaes/encrypted/image' int2str(i), '.jpg']);
imgP = reshape(re_plaintext, 128, 128);
imwrite(imgP,['videoaes/decrypted/Dimage' int2str(i), '.jpg']);
im(i)=image(frames);
end
I have two folders encrypted and decrypted, I want to convert these folders into avi video again.