Zend certified PHP/Magento developer

ffmpeg – always keep an open socket with camera, for performance boost [closed]

Today… I use the following command, with subprocess.PIPE, subprocess.Popen in python 3:
ffmpeg -an -i udp://{address_of_camera} -vf select=’if(eq(pict_type,I),st(1,t),gt(t,ld(1)))’ setpts=N/FRAME_RATE/TB -an -f rawvideo -vframes {NUM_WANTED_FRAMES} pipe:

This commands helps me to capture NUM_WANTED_FRAMES from a live camera, at a give moment.

However… it takes me about 4 seconds to read the frames, and about 2.5 seconds to open a socket between my computer and the camera’s computer

Is there a way, to have a socket/connection open always, between my computer and the camera’s computer? To save the 2.5 seconds?

I read something about fifo_size and overrun_fatal. I thought that maybe I can set fifo_size to be equal to NUM_WANTED_FRAMES, and overrun_fatal to True? Will this solve my problem? Or is there a different and simpler/better solution?

Thanks in advance,

Jeff