More optimizations for ffmpeg and mpv.