         private static function sortSPS(a:ByteArray, b:ByteArray):int
         {
             var ourEg:ExpGolomb = new ExpGolomb(a);
-            ourEg.readBits(28);
+            ourEg.readBits(8);
+            ourEg.readBits(24);
             var Id_a:int = ourEg.readUE();
 
             ourEg = new ExpGolomb(b);
-            ourEg.readBits(28);
+            ourEg.readBits(8);
+            ourEg.readBits(24);
             var Id_b:int = ourEg.readUE();
 
             return Id_a - Id_b;

            {
                var ppsLength:uint = ppsList[i].length;
                //trace("PPS length #" + i + " is " + ppsLength + "   " + Hex.fromArray(ppsList[i], true));
                avcc.position = cursor;
                ppsList[i].position = 0;
                avcc.writeShort(ppsLength);

                // Debug dump the SPS
                var spsLength:uint = spsList[i].length;

                //trace("SPS #" + i + " profile=" + spsList[i][1] + "   " + Hex.fromArray(spsList[i], true));

                var eg:ExpGolomb = new ExpGolomb(spsList[i]);
                // constraint_set[0-5]_flag, u(1), reserved_zero_2bits u(2), level_idc u(8)
                eg.readBits(8);
                eg.readBits(24);
                //trace("Saw id " + eg.readUE());

                avcc.position = cursor;
