lavf: improve handling of sparse streams when muxing