Fix a bug with interleaving video/audio

This should finally fix the out-of-sync issues with hardware encoders.
The data was not always properly being interleaved, and this should fix
the issue (again).  (The previous time I attempted this it didn't quite
work out as I had wanted)