WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Raspicam on Picore 11betab  (Read 5255 times)

Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Raspicam on Picore 11betab
« on: June 01, 2020, 11:52:46 AM »
Hi,

Very recent convert to PiCore here hoping to get the standard raspberry pi camera stuff working for monitoring of wildlife.  I notice ffmpeg is already so that's an excellent start.  :D
I appreciate this may not be very high on anyone else's list of priorities however I am prepared to do some learning and put in some time (however I do have a job and a family so that's not endless).

I'm pretty sure there is no extension (think that's the correct term - please correct me if not) currently existing for this and I'm wondering whether there is a process documented anywhere for getting something available in, let's say, Raspbian and modifying it so that it works in PiCore?

I have a programming background and some experience of Linux.  Any suggestions as to where I should start?  If this is a sensible way to go then I could contribute other extensions too I guess.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Raspicam on Picore 11betab
« Reply #1 on: June 01, 2020, 12:06:17 PM »
Camera stuff should be in the rpi-vc.tcz extension.

Which I see is not currently in the 11.x extension.   You can get it from the 10.x repo until someone copies it over.

There is alot of info in the FAQ's and wiki's on how things are handled.   Most extensions are compiled from source.   The rpi-vc is not, it is just copied from the rpi firmware github and packaged.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Raspicam on Picore 11betab
« Reply #2 on: June 01, 2020, 02:00:03 PM »
Is it still the case that rpi-vc is required - I thought I'd read that with the latest mesa and full kms, it was no longer required - or am I mixing two different things?

As a side issue libEGL.so, libGLESv2.so and libGLESv1_CM.so are duplicated in other extensions.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Raspicam on Picore 11betab
« Reply #3 on: June 01, 2020, 02:15:15 PM »
perhaps the graphics side handled elsewhere, but the camera support needs separate binaries.   And there are other things in there too,   vcgencmd, tvservice,.......

Perhaps we need to separate rpi-vc a bit further.


Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Re: Raspicam on Picore 11betab
« Reply #4 on: June 02, 2020, 02:59:24 AM »
Many thanks I'll investigate today and see where I get to.  Really appreciate your thoughts.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Raspicam on Picore 11betab
« Reply #5 on: June 02, 2020, 06:30:13 AM »
I did some testing without the rpi-vc extension.

The v4l-dvb-KERNEL extension was missing some modules, which have now been added.

First add a couple of lines to /mnt/mmcblk0p1/config.txt such that:
Code: [Select]
$ cat /mnt/mmcblk0p1/config.txt
...
[ALL]
# Enable camera
start_x=1
gpu_mem=128
..and reboot

Then load the required extensions:
Code: [Select]
$ tce-load -i libv4l2
$ sudo modprobe bcm2835-unicam

To take a photo:
Code: [Select]
$ v4l2-ctl --overlay=1 [enable viewfinder]
$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=photo.jpg

To record a video:
Code: [Select]
$ v4l2-ctl --overlay=1 [enable viewfinder]
$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4
$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=video.264
..adjust stream count for a longer video
« Last Edit: June 03, 2020, 04:03:27 AM by Juanito »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Raspicam on Picore 11betab
« Reply #6 on: June 02, 2020, 07:27:00 AM »
rpi-vc copied to the piCore-11.x repos - things seem to work, but care will need to be taken to avoid a clash with libEGL and friends.

Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Re: Raspicam on Picore 11betab
« Reply #7 on: June 02, 2020, 07:36:00 AM »
FANTASTIC!  many thanks

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Raspicam on Picore 11betab
« Reply #8 on: June 02, 2020, 08:26:05 AM »
Couple of interesting posts about the camera that I've not seen.....

https://www.raspberrypi.org/blog/an-open-source-camera-stack-for-raspberry-pi-using-libcamera/

And a FAQ to go with it.   https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=273018

Note that currently the piCore11 is using the 4.19 kernel tree, so libcamera is not going to work, but I think the data paths with respect to v4l2 are similar.   raspivid and raspistill are still going to be around.

Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Re: Raspicam on Picore 11betab
« Reply #9 on: June 03, 2020, 03:58:04 AM »
The libcamera stuff is very interesting thanks Paul.  I'm having a bit of trouble getting things working but I think that's more to do with me not having got my head around persistence of the config.txt that anything else.  When i've worked it out I'll feed back.   

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Raspicam on Picore 11betab
« Reply #10 on: June 03, 2020, 04:01:35 AM »
Video motion detection extension, motion, added to the repo - tested with an RPi3 and RPi camera using the default (v4l2) motion conf files  8)

Note that motion would not compile against rpi-vc mmal - it looks like it needs an update?


Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Re: Raspicam on Picore 11betab
« Reply #11 on: June 03, 2020, 05:58:26 AM »
Once I'd worked out I had to mount mmcblk0p1 in order to edit config.txt camera works fine!  Many thanks all.  Really pleased.  What a great project this is! :)

Offline RockJamm

  • Newbie
  • *
  • Posts: 20
Re: Raspicam on Picore 11betab
« Reply #12 on: June 03, 2020, 12:42:06 PM »
Looks like vlc isn't available at the moment - is that likely to be added to the repository?  Having investigated a bit further it looks like that is more helpful to me than FFmpeg and V4L2 (or raspivid) | vlc is likely to be the way i go.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Raspicam on Picore 11betab
« Reply #13 on: June 03, 2020, 12:45:34 PM »
Note that motion would not compile against rpi-vc mmal - it looks like it needs an update?

mmal looks like it has had 2 updates since the Rpi4 launch.   I'll update the package tonight.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Raspicam on Picore 11betab
« Reply #14 on: June 03, 2020, 01:43:37 PM »
What does vlc provide that the others don't?