Prevent corrupted recording when recording is interrupted.
It's very annoying to get partial video because the process died or was shutdown uncleanly. This fixes the issue. Here is an explanation of the options set:
Normally, a MOV/MP4 file has all the metadata about all packets stored in one location (written at the end of the file.
faststart: Will move the metadata to the beginning of the file after the recording is complete.
frag_keyframe: Starts a new fragment at each video keyframe. This allows a file to work, even if the metadata isn't written at the end or beginning of the file, since it encodes with each keyframe. (Tested with kill -9 on and start/stop recording where the end metata data wasn't written)
empty_moov: will cause output to be 100% fragmented; without this the first fragment will be muxed as a short movie (using moov) followed by the rest of the media in fragments.