Testing Testing Pinephone camera

dug into some docs on the image sensor, and found the test patterns!

and two full resolution:

recall: ubuntu touch + updated ffmpeg.

settings for v4l2-ctl (test_pattern changed to 1 – 4)

v4l2-ctl -d /dev/video1 -l

User Controls

                       contrast (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider
                     saturation (int)    : min=0 max=255 step=1 default=64 value=64 flags=slider
                            hue (int)    : min=0 max=359 step=1 default=0 value=0 flags=slider
        white_balance_automatic (bool)   : default=1 value=1 flags=update
                    red_balance (int)    : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
                   blue_balance (int)    : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
                       exposure (int)    : min=0 max=65535 step=1 default=0 value=16384
                 gain_automatic (bool)   : default=1 value=1 flags=update
                           gain (int)    : min=0 max=1023 step=1 default=0 value=16 flags=inactive, volatile
                horizontal_flip (bool)   : default=0 value=0
                  vertical_flip (bool)   : default=0 value=0
           power_line_frequency (menu)   : min=0 max=3 default=1 value=1

Camera Controls

                  auto_exposure (menu)   : min=0 max=1 default=0 value=1 flags=update

Image Processing Controls

                   test_pattern (menu)   : min=0 max=4 default=0 value=0

 

settings for the image capture

media-ctl -d /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:UYVY2X8/1280x720]'
ffmpeg -f rawvideo -pixel_format yuv420p -s 1280x720 -f video4linux2 -i /dev/video1 -vframes 1 ~/Pictures/$(date +"%Y%m%dT%H%M%S").jpg

and larger image (full sensor resolution, I think) with different pixel format

fname=$(date +"%Y%m%dT%H%M%S")
media-ctl -d /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:SBGGR8/2592x1944]'
ffmpeg -hide_banner -f rawvideo -pixel_format bayer_bggr8 -s 2592x1944 -f video4linux2 -i /dev/video1 -vframes 1 ~/Pictures/$fname-bggr8-big.jpg

 

have noticed full sensor pictures need more light.

solution:

20200301T105828-s

 

March 9 Update

updated to ubports build 246 and found the highest resolution no longer works; and the id of the sensor changed.
you can see this with the command

media-ctl -d /dev/media1 -p -v

Opening media device /dev/media1
Enumerating entities
looking up device: 81:1
looking up device: 81:2
Found 2 entities
Enumerating pads and links
Media controller API version 5.5.0

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial
bus info
hw revision     0x0
driver version  5.5.0

Device topology
- entity 1: sun6i-csi (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
	pad0: Sink
		<- "ov5640 3-004c":0 [ENABLED,IMMUTABLE]

- entity 5: ov5640 3-004c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev0
	pad0: Source
		[fmt:UYVY2X8/1280x720]
		-> "sun6i-csi":0 [ENABLED,IMMUTABLE]

so a command to set resolution and image type is now:

media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:UYVY2X8/1920x1080]'

The version changed also.  Searching online I see a change in the driver code that was made to allow only the highest resolution at 15 frames per second.

I am just using command line media-ctl, v4l2-ctl and ffmpeg commands; which I assume do not set the frame rate?

If anyone knows how to set frame rate via cli, comment!

found it, add @1/5 to end of setting;
oddly initially did not seem to work, needed to send command with time first with lower resolution, THEN the higher resolution one.

media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:SBGGR8/1280x960@1/15]'
media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:SBGGR8/2500x1600@1/15]'

20200312T072523-bggr8-big

This entry was posted in tech. Bookmark the permalink.

1 Response to Testing Testing Pinephone camera

  1. Tom says:

    Thanks for this. Very handy.

    “oddly initially did not seem to work, needed to send command with time first with lower resolution, THEN the higher resolution one.” was surprising, but also causing me issues.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s