Does it actually help to have all layers separated from each other?
Here is the RoadRunner clip with all layers separated from each other, and all possible combinations of them. You should use the following script to view it:
clip = AVIsource("allinone-noaudio.avi").deleteframe(0)
function split(clip c, bool horizontal, string layername, int hlevel) {
c1 = subtitle(c.selectrangeevery(2400,1200), layername + " off", x=hlevel*20, y=hlevel*20 )
c2 = subtitle(c.trim(1200,0).selectrangeevery(2400,1200), layername + " on" , x=hlevel*20, y=hlevel*20)
return horizontal ? stackhorizontal(c1, c2) : stackvertical(c1, c2)
}
return clip.split(true, "sprites", 4).split(true,"bg4", 3).split(true,"bg3",2).split(false,"bg2",1).split(false,"bg1",0)
Note: While you can make reliable assumptions on the order of the background layers, this is not true for the sprite layer, see frame 433 for an example. It should be possible to create separate encodes for every sprite priority (3,2,1,0)... Well, they would take a very long time, because you need to create a savestate for each frame of the final video, and you need to load a savestate for each frame and for each priority...
The order of the layers should be no problem, because it is possible to test all possible versions automatically, but it would still be necessary to render all the "sprite layers" separately...