I am using the following FFMpeg command to convert a H.264 UDP streamed video from a Tello drone to another address.
ffmpeg -i udp://0.0.0.0:11111 -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -f h264 udp://127.0.0.1:5000
Then I simply use the following OpenCv to read from that new address:
this.Capture = new OpenCvSharp.VideoCapture("udp://127.0.0.1:5000", OpenCvSharp.VideoCaptureAPIs.FFMPEG);
From this Capture reference, i obtain the next frame by calling this.Capture.Read(mat). When i assigned the convert image to the UI, the image is pixel perfect!
However, after the initial rendering, i am not seeing immediate updates. But i do see very laggy video updates that is very distorted. It looks like each consecutive frame is just the delta/difference drawn on top of the previous frame.
Is there anything i can tweak/modify in my FFMpeg command to resolve this distorted video rendering?
Update 1 I was able to make some progress. The video updates, still with distortion, but overall distortion is a bit less. And the frames update more responsively.
To get to this point, i simply added this parameter to my FFMpeg command:
-g 100
I also tried:
-g 300