v4l2loopback
Problem
Recently we just installed our traffic counting and trespassing system at the grade-crossing location. One thing we didn’t expect was that both live feed program and analysis program will require camera data, but they cannot do it at the same time. How to copy the camera device with efficiency becomes a problem.
Solution
Hopefully we have the great kernel module v4l2loopback which can create loop back devices. Then we use ffmpeg to pipe real camera into 2 separate virtual video devices to achieve concurrency.
One tricky part is since we are using nvidia jetson, it’s ubuntu is customized, so you need to build some header modules first.
1 | cd /usr/src/linux-headers-4.4.38-tegra |
Then the v4l2loopback can be built successfully.
Links
https://devtalk.nvidia.com/default/topic/1023416/error-building-v4l2loopback/