Best way to encode video is to use a scene detect algorithm to chunk up the video into multiple parts, configure your encoder to encode those parts with a single CPU thread, and spin off one thread per scene to your CPU's max amount of threads. You then just concat the scenes together afterwards.