function [Y statt]=getLuma(file, nFrames, W, H)
ffstring=sprintf('ffmpeg\\ffmpeg -i "%s" -vframes %d -pix_fmt gray -y temp.yuv',...
            file, nFrames); % creating ffmpeg command
[a,b]=system(ffstring);
if a==0
    fid=fopen('temp.yuv');
    Ytemp=fread(fid, '*uint8');
    fclose(fid);
    Y=reshape(Ytemp,W,H, nFrames);
    Y=permute(Y, [2 1 3]);
    statt=1;
else 
       warndlg('Unexpected error occured. Close the aplication and/or try other video file.', 'Unexpected error')
Y=[];
statt=0;
return
end
