mreko
Posts: 2
Joined: Tue Mar 10, 2015 2:27 am

Need help using Picamera on Mac

Tue Mar 10, 2015 2:48 am

Hi,everybody!Please help me out,I am so frustrated...
Here is my issue:
I'm trying to use PI camera on Mac(Python2.7) to do a live video streaming.

First of all,I install the PI camera by using pip install picamera:

(venv)55-213:video_streaming mreko$ pip install picamera
Requirement already satisfied (use --upgrade to upgrade): picamera in ./venv/lib/python2.7/site-packages


Then,I write a py script:

import time
import picamera

with picamera.PiCamera() as camera:
camera.resolution = (1024, 768)
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('foo.jpg')


Then I compile this file it throw an error:

(venv)55-213:video_streaming mreko$ python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
import picamera
File "/Users/mreko/python_workstation/video_streaming/venv/lib/python2.7/site-packages/picamera/__init__.py", line 258, in <module>
from picamera.exc import (
File "/Users/mreko/python_workstation/video_streaming/venv/lib/python2.7/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/Users/mreko/python_workstation/video_streaming/venv/lib/python2.7/site-packages/picamera/mmal.py", line 47, in <module>
_lib = ct.CDLL('libmmal.so')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libmmal.so, 6): image not found
(venv)55-213:video_streaming mreko$



I guess it can not find 'libmmal.so' on my mac lib.
And I know on Mac,the lib's suffix is 'dylib'.Therefore,I changed it into 'libmmal.dylib'.But still,it can't find it.

I really don't know how to solve this problem.I wonder maybe Picamera can't support Mac?Is there any Picamera version for mac? Or is there any way that I can install libmmal.dylib on mac?

Please help me out!
I hope you can give me the answer.It drives me crazy!

Thank a lot!

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6043
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: I am a desperate person who need a help!

Tue Mar 10, 2015 3:55 am

I'm very confused. How do you intend to use the camera on a Mac? It can only plug into the pi.

mreko
Posts: 2
Joined: Tue Mar 10, 2015 2:27 am

Re: I am a desperate person who need a help!

Tue Mar 10, 2015 5:21 am

ShiftPlusOne wrote:I'm very confused. How do you intend to use the camera on a Mac? It can only plug into the pi.
Cause I want to do a video streaming by using my mac's camera to capture the video.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: I am a desperate person who need a help!

Tue Mar 10, 2015 5:27 am

mreko wrote:Cause I want to do a video streaming by using my mac's camera to capture the video.
The picamera Python module is specific to the Raspberry Pi and the Raspberry Pi Camera module.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6043
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: I am a desperate person who need a help!

Tue Mar 10, 2015 4:02 pm

Yeah, then you don't want to be using picamera.

User avatar
cyrano
Posts: 714
Joined: Wed Dec 05, 2012 11:48 pm
Location: Belgium

Re: I am a desperate person who need a help!

Tue Mar 10, 2015 4:44 pm

mreko wrote:
ShiftPlusOne wrote:I'm very confused. How do you intend to use the camera on a Mac? It can only plug into the pi.
Cause I want to do a video streaming by using my mac's camera to capture the video.
Your Mac just might have the tools necessary built in. If not, Quicktime Streaming Server is free.

https://www.apple.com/quicktime/extendi ... urces.html

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Need help using Picamera on Mac

Wed Mar 11, 2015 6:25 pm

Mod Edit: Changed name of thread to something useful
Dear forum: Play nice ;-)

Return to “Off topic discussion”