-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.m
29 lines (24 loc) · 1.08 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%=== Set directories to store video frames ===%
workingDir = 'frames';
%=== exist with two arguments is better than single argument as it searches for all categories (file, dir, var, func, buitlin etc) ===%
%=== when a single argument is given. So, its better to provide specific category as second argument to search for... ===%
if( exist(workingDir, 'dir') )
rmdir(workingDir, 's');
end
mkdir(workingDir);
mkdir(workingDir,'framesRGB');
mkdir(workingDir,'framesY');
mkdir(workingDir,'framesU');
mkdir(workingDir,'framesV');
%=== Get video reader obj for the video ===%
video = VideoReader('small.mp4');
%=== construct frames and get their dimentions from the video reader object ===%
%=== store them in these directories ===%
[height, width] = construct_frames(video, workingDir, 'framesRGB', 'framesY', 'framesU', 'framesV');
%=== Get no of frames of the video ===%
noOfFrames = floor(video.FrameRate*video.Duration) - 1;
disp(noOfFrames);
%=== Fix a key ===%
key = 5;
%=== scamble the video frames ===%
scramble(key, height, width, noOfFrames, workingDir, 'framesY', 'framesU', 'framesV');