%Open an handle to the AVI file on the server
%
% avi_filename is the full DOS path to the AVI file on the win32/win64 server
% server is the ip addres / server name
avi_filename = ['<DOS path of video file on the server>'];
server = '<Server hostname / IP address>';
port_number = 12345; % Port number for netAvi server specified on the netAvi server command line.

[avi_hdl, avi_inf] = netAviOpen(avi_filename, server, port_number);

for frame_num = 1:avi_inf.NumFrames/10:avi_inf.NumFrames;
	
	%Reads frame_num from the AVI
	pixmap = netAviReadMex(avi_hdl, frame_num);
	img = reshape(pixmap,[avi_inf.Height,avi_inf.Width,3]);

	imshow(img/256);
	title(sprintf('frame number %d',floor(frame_num)));
	fprintf('Press any key\n');
	pause;
end

%Cleanup
netAviCloseMex(avi_hdl);
