I believe an easier way would be to use Snapz Pro ( https://www.ambrosiasw.com/utilities/snapzprox/ ) to record the part of the screen you want to record into a QuickTime file. Later you can convert that file into any format. I’m quite sure that’s the way Apple does it.