如何通过ffmpeg加速rtsp流的截图捕获?

I want to capture a fresh screenshot from an rtsp stream and pass the data on via php whenever an ajax endpoint is called.

Currently I am simply running

$resp = exec( 'ffmpeg -rtsp_transport tcp -y -i '.$post['link'].' -vframes 1 '.$path.$imagename);

The problem is this takes a lot of time to generate a screenshot, about 4 second per capture if the stream is good. If the stream drops frames or causes an error, I won't get a response and the script will timeout.

Is there a way to optimize this or allow for fault tolerance? And overall speedup things so I can get a screenshot every second? If there's a better solution over ffmpeg, I am willing to try it as well!