elixir-vision / picam

Elixir library used to capture MJPEG video on a Raspberry Pi using the camera module.
Other
122 stars 27 forks source link

GenServer exiting with :unexpected_exit #14

Closed ricn closed 7 years ago

ricn commented 7 years ago

Hi,

I just tried to use picam on my Raspberry Pi 3 running Nerves but I only get this error:

iex(rpi3@192.168.1.251)1> Picam.Camera.start_link {:ok, #PID<0.440.0>} iex(rpi3@192.168.1.251)2> 20:10:04.387 [warn] Camera GenServer exiting: :unexpected_exit

22:10:24.982 [error] GenServer Picam.Camera terminating (stop) :unexpected_exit Last message: {#Port<6189.2630>, {:exit_status, 1}} State: %{port: #Port<6189.2630>, requests: []} (EXIT from #PID<0.437.0>) :unexpected_exit

Am I doing something wrong?

fhunleth commented 7 years ago

You didn't do anything wrong. Apparently we need some better error reporting.

I'm wondering if it is possible for you to try running the raspijpgs binary manually. For example, via :os.cmd or by going to a shell (either by setting up erlinit to exit to a shell or by including Nerves.Runtime and typing "CTRL-G, s sh, c". You can find binary in :code.priv_dir(:picam). All of the places where it exits are supposed to print something to stderr, so I'm hoping that gives another clue.

ricn commented 7 years ago

Ah thanks. I will try that as soon as I can and report back to you.

ricn commented 7 years ago

This is the error I got when running the raspijpgs command manually using iex:

iex > exe = Path.join(:code.priv_dir(:picam), "raspijpgs") iex > :os.cmd(to_charlist exe)

'mmal: mmal_vc_port_enable: failed to enable port vc.ril.image_encode:in:0(RGBA): ENOMEM mmal: mmal_port_enable: failed to enable connected port (vc.ril.image_encode:in:0(RGBA))0x46b340 (ENOMEM) mmal: mmal_connection_enable: output port couldn\'t be enabled raspijpgs: Could not enable connection resizer -> encoder'

ricn commented 7 years ago

I can also confirm that both raspivid and raspistill works with my Camera using Nerves.

electricshaman commented 7 years ago

Can you try setting gpu_mem to a higher value in /boot/config.txt? Try 192.

gpu_mem=192

ricn commented 7 years ago

It's working now. Thanks! :smiley_cat:

electricshaman commented 7 years ago

Excellent! This seems to only affect the V2 camera modules. I'll make a note in the README.