Im having problems with VideoWriter class: I have multiple threads, and every one does:
- capture frame (VideoCapture)
- resize
- write frame (VideoWriter)
Every thread captures a different camera.
If I have 1 camera, the videos looks fine. With 2 cameras, the videos lose lots of frames in batches and start to have encode errors. With more cameras, the videos are even shorter and have lots more of corrupted frames.
I work on Ubuntu and my cameras are IP.
The video codec I need to use is h264. How can I get better videos? Or at least, videos with less FPS but not corrupted frames or frames lost in a batch?
Note: I tried to run 2 or more independent processes that captures and write one video each. Same behavior.