Write output movie to a tmp name, then combine original audio track with new video track (with overlay) to produce the final video.  It's really nice to preserve the audio track because the motor sound also contributes to an intuitive sense of what is happening and helps connect the video to reality.
Write output movie to a tmp name, then combine original audio track with new
video track (with overlay) to produce the final video.  It's really nice to
preserve the audio track because the motor sound also contributes to an
intuitive sense of what is happening and helps connect the video to reality.

UASLab/ImageAnalysis