PINE64
Live Camera View - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: General Discussion on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=127)
+--- Thread: Live Camera View (/showthread.php?tid=9267)



Live Camera View - mpnordland - 02-23-2020

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.

Code:
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.

Troubleshooting

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:

Code:
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.


RE: Live Camera View - dukla2000 - 02-24-2020

(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 :-) )


RE: Live Camera View - dejvino - 02-24-2020

For some reason I had a disabled link into the back camera in V4L2 and mpv wouldn't run, saying:
Code:
[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:

Code:
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:

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