camera + megaixel and strange behavior
#1
Hi Guys 

Please help me out nail the issue with my camera.

Im using PostmarketOS image and i was using Megapixel camera. Megapixel shows picture from camera (a lot of violet colours) but if i click button to make image it suddently hang megapixel.
No image will be saved anywhere in /home/user dir

i tried to make a workaround to use https://git.sr.ht/~martijnbraam/python-pinecamera
camera.py which doesnt work as well:

im getting something like this
Code:
> ./camera.py still --resolution 720p photo.jpg
Unable to parse link: Invalid argument (22)
Unable to parse link: Invalid argument (22)
Unable to setup formats: Invalid argument (22)
^CTraceback (most recent call last):
  File "/usr/lib/python3.8/subprocess.py", line 495, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.8/subprocess.py", line 1028, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.8/subprocess.py", line 1894, in _communicate
    self.wait(timeout=self._remaining_time(endtime))
  File "/usr/lib/python3.8/subprocess.py", line 1083, in wait
    return self._wait(timeout=timeout)
  File "/usr/lib/python3.8/subprocess.py", line 1798, in _wait
    raise TimeoutExpired(self.args, timeout)
subprocess.TimeoutExpired: Command '['sudo', 'v4l2-ctl', '--device', '/dev/video1', '--stream-mmap', '--stream-to=/tmp/frame.raw', '--stream-count=1', '--stream-skip=5']' timed out after 9.99975883199977 seconds


i even tried to use ffmpeg then with options like:


Code:
sudo ffmpeg -f v4l2 -framerate 10 -i /dev/video0 -preset ultrafast /home/user/some-vid.vid
getting:
[video4linux2,v4l2 @ 0xffffb76d2670] Not a video capture device.
/dev/video0: No such device
--------------------------------------------------------------------------------------------------------------------
sudo ffmpeg -f v4l2 -framerate 10 -i /dev/video1 -preset ultrafast /home/user/some-vid.vid
getting:
[video4linux2,v4l2 @ 0xffff90699670] Not a video capture device.
/dev/video1: No such device
--------------------------------------------------------------------------------------------------------------------
sudo ffmpeg -f v4l2 -framerate 10 -i /dev/video2 -preset ultrafast /home/user/some-vid.vid
getting:
[video4linux2,v4l2 @ 0xffffb72a0670] Not a video capture device.
/dev/video2: No such device
--------------------------------------------------------------------------------------------------------------------
sudo ffmpeg -f v4l2 -framerate 10 -i /dev/video3 -preset ultrafast /home/user/some-vid.vid
getting:
[video4linux2,v4l2 @ 0xffff9ba3c670] ioctl(VIDIOC_STREAMON): Broken pipe
/dev/video3: Broken pipe
--------------------------------------------------------------------------------------------------------------------


Update 1:

quick look in dmesg after fresh OS start and trying to make a picture in megapixel (where megapixel hangs)

Code:
+[  124.878718] ov5640 4-004c: firmware upload success
+[  125.177354] ov5640 4-004c: uploaded firmware didn't start, got to 0x7f, retrying...
+[  125.477370] ov5640 4-004c: uploaded firmware didn't start, got to 0x7f
+[  125.477425] ov5640 4-004c: ov5640_set_ctrl_focus: no autofocus firmware loaded
+[  128.819814] ov5640 4-004c: firmware upload success
+[  129.117310] ov5640 4-004c: uploaded firmware didn't start, got to 0x7f, retrying...
+[  129.417331] ov5640 4-004c: uploaded firmware didn't start, got to 0x7f
+[  129.417385] ov5640 4-004c: ov5640_set_ctrl_focus: no autofocus firmware loaded

Update 2:

after fooling around with some options and lurking @ internets i found that:

Code:
sudo media-ctl -d /dev/media1 --links "ov5640 3-004c":0->"sun6i-csi":0[0]

running before megapixels camera fixes issue with violet-colour image in megapixels, and megapixels started doing pictures to /home/user/Pictures DIR, YAY! 

but..  still.. 
i didnt figured out what options are needed to make image using pine's camera from terminal (eg using ffmpeg or camera.py)
any help appreciated

Update 3:

I checked device info

Code:
> media-ctl -d /dev/media1 -p
Media controller API version 5.11.0

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial         
bus info        platform:1cb0000.csi
hw revision     0x0
driver version  5.11.0

Device topology
- entity 1: sun6i-csi (1 pad, 2 links)
            type Node subtype V4L flags 0
            device node name /dev/video3
    pad0: Sink
        <- "ov5640 4-004c":0 [ENABLED]
        <- "gc2145 4-003c":0 []

- entity 5: ov5640 4-004c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev0
    pad0: Source
        [fmt:SBGGR8_1X8/1280x720@1/15 colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
        -> "sun6i-csi":0 [ENABLED]

- entity 7: gc2145 4-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev1
    pad0: Source
        [fmt:UYVY8_2X8/1600x1200@1/10 field:none]
        -> "sun6i-csi":0 []


so i thought i found proper configurations that seems to be something like that:

Code:
media-ctl -d /dev/media1 --set-v4l2 '"ov5640 4-004c":0[fmt:UYVY8_2X8/1280x720]'

according to previous info

but.. when switched to this mode, MEGAPIXEL again turns into violet-colour mode and hangs after trying to do a picture..

and then i tried to make a use of ffmpeg,  which seems to work: 

Code:
ffmpeg -s 1280x720 -f v4l2 -i /dev/video3 -vframes 1 selfie.jpg


..but prodces only "whole-green" jpg

output:

Code:
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.1 (Alpine 10.2.1_pre1) 20201203
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --enable-vulkan --enable-libsoxr --enable-libaom --disable-debug
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, video4linux2,v4l2, from '/dev/video3':
  Duration: N/A, start: 2228.856409, bitrate: 165888 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 165888 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
File 'selfie.jpg' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0xffffb7670020] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'selfie.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=1.8 Lsize=N/A time=00:00:00.06 bitrate=N/A speed=0.156x   
video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


and on 
Code:
ffmpeg -s 1280x720 -f v4l2 -i /dev/video1 -vframes 1 selfie.jpg

doesnt work

UPDATE: Last Smile

in act of desperation i installed fswebcam and then fool around a little bit and, voilla:

Code:
sudo fswebcam --device=/dev/video3 -r 1280x720 -p UYVY -S 10 UYVY-XX.jpg

fswebcam works Smile and for now fit my needs perfectly Smile

bottom line: never give up Smile
  Reply


Messages In This Thread
camera + megaixel and strange behavior - by streak - 06-02-2021, 06:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PostmarketOS Camera and ffmeg rafiki88 1 1,833 03-19-2022, 10:09 AM
Last Post: vap0rtranz
  Would another camera work in the PP? nelstomlinson 2 2,705 11-11-2021, 06:25 PM
Last Post: nelstomlinson
Sad Have I got a broken camera module? AKD251 2 2,720 11-07-2021, 11:12 AM
Last Post: beta-user
  camera firmware problems kqlnut 25 25,526 09-02-2021, 07:49 PM
Last Post: Zebulon Walton
  Pinephone camera thread ryo 8 9,617 05-29-2021, 03:21 AM
Last Post: ryo
  Camera clicking sound unsatisfactory212 2 3,279 05-07-2021, 02:57 PM
Last Post: megous
  Strange SD Card Problems anhilde 7 7,661 02-21-2021, 07:52 AM
Last Post: Zebulon Walton
  Main Board Swap: Camera connector problems tyha 5 5,520 11-19-2020, 06:25 PM
Last Post: pajux
  Camera with stange colors zykran 0 1,746 09-18-2020, 10:05 AM
Last Post: zykran
  camera question xinyiman 3 5,113 08-31-2020, 05:50 AM
Last Post: Veraendert

Forum Jump:


Users browsing this thread: 1 Guest(s)