private void ReadVideo(String fileName, int primary) throws FileNotFoundException, IOException{
        
        byte[] videoFile;
        byte r, g, b;
        
        System.out.println(fileName);
        File file = new File(fileName);
        InputStream is = new FileInputStream(file);
        
        int offset = 0;
        int numRead = 0;
	videoFile = new byte[(int)file.length()];
         
        //reading the input file into bytes array
	while (offset < videoFile.length && (numRead=is.read(videoFile, offset, videoFile.length-offset)) >= 0) {
            offset += numRead;
        }
        //System.out.println("videoFile length="+videoFile.length);        
        
        if(primary==1){
            primaryFileName = fileName;
            primaryVideoFrames = new int[(videoFile.length/(3*height*width))][width][height];
        }
        else{
            secondaryFileName = fileName;
            secondaryVideoFrames = new int[(videoFile.length/(3*height*width))][width][height];
        }
        
        int counter = 0, pix;
        for(int i=0; i<720; i++){
            for(int j=0; j<288; j++){
                for(int k=0; k<352; k++){
                    r = videoFile[counter];
                    g = videoFile[counter+352*288];
                    b = videoFile[counter+352*288*2];
                    
                    pix = 0xff000000 | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
                    
                    if(primary==1)
                        primaryVideoFrames[i][k][j] = pix;
                    else
                        secondaryVideoFrames[i][k][j] = pix;
                    counter++;
                }
            }
            counter += (2*height*width); //jump to next frame index
        }
        if(primary==1)
            jSlider1.setValue(0);
        else
            jSlider2.setValue(0);
    }