public void saveMetaRecords() throws IOException{
        Metafile record;
        KeyFrame key;
        String metaFile = "";
        primaryFileName = primaryFileName.split(".rgb")[0];
        System.out.println("primary file name "+primaryFileName.split(".rgb")[0]);
        FileWriter fstream = new FileWriter(primaryFileName+".meta");
        BufferedWriter out = new BufferedWriter(fstream);
        
        for(int i=0; i<metaRecords.size(); i++){
            
            record = metaRecords.get(i);
            Collections.sort(record.kf, new customComparator());
            
            metaFile += record.rectID+" "+record.rectName+ " "+record.numOfKeyFrames+"\r\n";
            metaFile += record.linkedVideoName+" "+record.linkedVideoStartFrame+"\r\n";
            
            for(int j=0; j<record.numOfKeyFrames; j++){
                key = record.kf.get(j);
                metaFile += key.frameNum+" "+key.topLeftX+" "+key.topLeftY+" "+key.bottomRightX+" "+key.bottomRightY+"\r\n";
            }
        }
        out.write(metaFile);
        out.close();
        System.out.println("written to file");
    }