Live Camera View
Up for a crude, barely functional method for taking photos with your PinePhone?
Of course you are. You wouldn't have one otherwise.

It's not too hard either. Credit to the postmarketOS wiki as it had the hard part.
You will need to install the mpv and v4l-utils packages.

media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:UYVY8_2X8/1280x720]'
mpv av://v4l2:/dev/video1

Press 's' at any time to take a photo. Press 'q' to exit.

I recommend making this into a script and copying it to your SD card so you can avoid typing it in by hand.


The pmOS wiki states that the entity name is "ov5640 2-003c". I found that not to work.

If you get a message stating "Invalid argument (22)" then you may have the wrong entity name. Fortunately, you can get it like this:

media-ctl -d /dev/media1 -p

There should be two entities listed, one a source and the other a sink. You want the entity name for the sink. It will look like the ones mentioned above.
(02-23-2020, 09:47 PM)mpnordland Wrote: ...
You will need to install the mpv and v4l2-utils packages.

typo - should be v4l-utils

Actually gives a reasonable pic if I allow auto-focus or whatever to work (probably hold the thing still - back to camera basics :-) )
  • ROCKPro64 v2.1 2GB, 16Gb eMMC for rootfs, SX8200Pro 512GB NVMe for /home, HDMI video & sound, Bluetooth keyboard & mouse. Arch (5.19 kernel, Openbox desktop) for general purpose daily PC.
  • PinePhone Pro Explorer Edition daily driver, Tow-boot on SPI, Arch/phosh on eMMC
  • PinePhone BraveHeart now v1.2b 3/32Gb, Tow-boot with Arch/Phosh on eMMC
For some reason I had a disabled link into the back camera in V4L2 and mpv wouldn't run, saying:
[ffmpeg/demuxer] video4linux2,v4l2: ioctl(VIDIOC_STREAMON): Link has been severed
Looking at the output from `media-ctl -d /dev/media1 -p` it had a link enabled to the front camera instead.

After deciphering the media-ctl help I was able to enable the correct link via this:

media-ctl -d /dev/media1 -l '"ov5640 3-004c":0->"sun6i-csi":0[1]'
Then mpv finally showed the camera feed! ... and crashed immediately on failed memory allocation.

Anyway, using mplayer is also possible and the video was nice and fluent:

mplayer tv:// -tv driver=v4l2:width=1280:height=720:device=/dev/video2 -fps 30

Possibly Related Threads…
Thread Author Replies Views Last Post
  To live and die on LTE (with a Pinephone) robthebold 2 740 07-08-2022, 11:57 AM
Last Post: robthebold
  PinephonePro camera calibration conundrum orbital 0 327 07-06-2022, 09:09 AM
Last Post: orbital
  Camera on manjaro arm transfer76 7 2,463 03-18-2022, 10:11 PM
Last Post: Ant
  Problems with Pinephone camera ov5640 wfk 0 924 06-29-2021, 01:53 AM
Last Post: wfk
  fix camera, mobian rvh 3 2,199 03-20-2021, 03:51 PM
Last Post: rvh
Bug Camera doesn't work. SD-Card isn't mounted automatically pavel-hh 1 1,899 07-22-2020, 04:34 PM
Last Post: pavel-hh
  CAMERA WORKS!!! BlueDeer 7 6,169 07-22-2020, 11:27 AM
Last Post: wibble

Forum Jump:

Users browsing this thread: 1 Guest(s)