Access camera from CLI?
-
Hi,
I'm brand new with this, please be gentle.I try to take a picture with my phone's camera from the command line and do not get it to work. Eg. streamer (via Libertine) says:
phablet@ubuntu-phablet:~$ libertine-launch -i xenial streamer -c /dev/video0 -o outfile.jpeg : DISPLAY environment variable not set! files / video: JPEG (JFIF) / audio: none v4l2: open /dev/video0: Device or resource busy vid-open: failed: libv4l no grabber device available
What is 'busying' my camera? I tried this with all my video devices listed – errors vary, but none works:
phablet@ubuntu-phablet:~$ ls /dev/video* /dev/video0 /dev/video2 /dev/video33 /dev/video35 /dev/video39 /dev/video1 /dev/video32 /dev/video34 /dev/video38 /dev/video: q6_dec q6_enc venus_dec venus_enc
I also tried with different apps (besides streamer) and a restart (in case some app would still block the camera). The phone I use is a 'oneplus one' running ut 16.04 (OTA-11) and the camera app works perfectly fine. Am I missing something super obvious?
Any help is highly appreciated, thanks a lot in advance!!!
Karledit, maybe helpful:
phablet@ubuntu-phablet:~$ libertine-launch -i xenial v4l2-ctl --list-devices : DISPLAY environment variable not set! VIDIOC_QUERYCAP: failed: Invalid argument VIDIOC_QUERYCAP: failed: Invalid argument VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Invalid argument VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Invalid argument VIDIOC_QUERYCAP: failed: Invalid argument VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device msm_vdec_8974 (): /dev/video32 /dev/video33 /dev/video38 /dev/v4l-subdev4 /dev/v4l-subdev17 /dev/v4l-subdev16 /dev/v4l-subdev0 /dev/v4l-subdev1 /dev/v4l-subdev2 /dev/v4l-subdev3 /dev/v4l-subdev15 /dev/v4l-subdev5 /dev/v4l-subdev6 /dev/v4l-subdev7 /dev/v4l-subdev8 /dev/v4l-subdev9 /dev/v4l-subdev10 /dev/v4l-subdev11 /dev/v4l-subdev12 /dev/v4l-subdev13 /dev/v4l-subdev14 (D?ֶ?r): /dev/video1 /dev/video2 Failed to open /dev/video0: Device or resource busy
-
Cameras on Android phones are not normal v4l devices, and must be accessed through the Android HAL, which is how Ubuntu Touch interacts with all the hardware on Android devices.
So, you will not be able to use standard Linux CLI tools to access the camera in such a way. You will need an app using Qt Camera API, packaged in a click, to access the camera (which also requires user granting permission to the app).
-
hi dobey,
thank you very much for clearing this up!that said … bummer!
actually, i got this phone only because i hoped, i could use it not as phone, but as a development tool. pretty much like a raspberry pi but with battery, cameras, screen, connectivity and sensors all in one nifty packet … but ok, if all hardware is only exposed to qt, that certainly will not work. : (one question though: i have seen here on the forums, that there is a community dedicated to get ubuntu touch to run on raspberry pis … might there also exist something like this, but in reverse? like some sort of unix (cli/ssh would be perfectly sufficient) running on (and being able to fully leverage) phone hardware?
in any way, again: thank you so much for helping me out!
karl