Thanks guys, it works okay so far with ref=1:mixed_refs. What a relief. A bit pointless supporting h264 if frames can only reference those immediately before themselves.