ffmpeg: Why did my capture speed drop? (can no longer capture using same command)
Since it also happens with -f null, but not with another Codec, the CPU load during the capture is a possible explanation. You did not mention it in your question. Is there any specific reason to use -threads 4? Try raising that number or omit the parameter.