Fix #1417, #1411, make video file size code more robust.