On 1/8/21 6:59 AM, Palaha, Arvinder (DLSLtd, RAL, LSCI) via Tech-talk wrote:
> Dear tech-talk-ers,
>
> I'm having a look again at implementing controls for a usb camera using the v4l2 driver, and my approach is to use a python ioc to issue commands and set up and control an ffmpeg server, and hopefully pipe in the video stream into areaDetector/AD. I think
this seems reasonable, but if there are better approaches, I'd be eager to hear them 🙂
>
> Looking back through the archive, it seems this was looked at in 2014, and potentially before then also. Has there been any progress on this topic since then?
>
> If/when I do get this running, I'll post on here about it as it seems it'd be useful.
>
> Wishing everyone good health and happy new year,
I've uploaded a small project I did ~2 years ago. It reads frames from
a V4L2 device, and publishes them with PV access (as an NTNDArray).
This can be viewed directly with eg. cs-studio or pydm. It can also
be read into areaDetector with the PVA client camera driver.
https://github.com/mdavidsaver/p4pvid
Big caveat. This was a weekend project which has only been tested with
laptop webcams. It supports only a limited number of color modes
(GRAY, YUYV, and a few others untested).
Still, it should at least be easy to test.
> git clone
https://github.com/mdavidsaver/p4pvid
> cd p4pvid
> virtualenv -p python3 env
> . env/bin/activate
> python -m pip install -r requirements.txt
> python setup.py build_ext -i
> python -m p4pvid /dev/video0 vidpv
Then you can eg. point a cs-studio/phoebus image widget at "pva://vidpv".