Fix video recording sync drift (patch refactored but original author unknown)