function makevideo3_notitle(frames1, frames2, frames3, filename)
% Created by Yuandong Tian, Oct. 5, 2009
% Email: yuandong@andrew.cmu.edu
% make video from three frames. using mencoder (please install one if you don't have it)

tmpfile = 'tmp.xxoo.avi';
aviobj = avifile(tmpfile);

if size(size(frames1)) == 3
    [m, n, nFrame] = size(frames1);
    nChannel = 1;
    isMono = true;
else
    [m, n, nChannel, nFrame] = size(frames1);
    isMono = false;
end;

bgcolor = [0.7, 0.9, 0.7];
fgcolor = [0.1, 0.1, 0.1];
ox = 8;
oy = 20;

marginx = 5;
marginy = 0;
videoframe = zeros(m + marginy, 3*n + 2*marginx, nChannel);
for i = 1:nFrame
    if isMono
        videoframe(marginy + (1:m), 1:n)                     = frames1(:, :, i);
        videoframe(marginy + (1:m), marginx + (n+1:2*n))     = frames2(:, :, i);
        videoframe(marginy + (1:m), 2*marginx + (2*n+1:3*n)) = frames3(:, :, i);
    else
        videoframe(marginy + (1:m), 1:n, :)                     = frames1(:, :, :, i);
        videoframe(marginy + (1:m), marginx + (n+1:2*n), :)     = frames2(:, :, :, i);
        videoframe(marginy + (1:m), 2*marginx + (2*n+1:3*n), :) = frames3(:, :, :, i);
    end;
    
    imshow(videoframe);

    frame = getframe(gca);
    aviobj = addframe(aviobj, frame);
end;
aviobj = close(aviobj);
% use mencoder to transfer video format
% eval(['! mencoder -o ' filename ' -ovc lavc -lavcopts
% vcodec=mpeg4:mbd=2:trell:v4mv:last_pred=2:dia=-1:vmax_b_frames=2:vb_strategy=1:cmp=3:subcmp=3:precmp=0:vqcomp=0.6:turbo ' tmpfile ' >/dev/null']);
eval(['! mencoder -o ' filename ' -ovc lavc -lavcopts vcodec=wmv2 ' tmpfile ' >/dev/null']);
eval(['! rm ' tmpfile]);