Investigate using threading or multiprocessing to split different parts of the processing pipeline up to make better use of multiple CPU cores. In general, video decoding followed by encoding take up the most processing time in the pipeline overall. Encoding is more CPU intensive, but typically there are less frames to encode than the input video contains, thus it consumes less overall CPU time when processing a given input video.