Coder Social home page Coder Social logo

Comments (8)

waveform80 avatar waveform80 commented on April 28, 2024

Unfortunately, this requires root access. Moreover, as the follow-on message in the thread indicates, while it would protect against MMAL-based apps simultaneously accessing the camera, it wouldn't protect against OpenMAX-based apps. For now, the best we can reasonably do (without requiring root access, which is excessive for such a minor feature) is simply ensure the class itself isn't accidentally instantiated multiple times.

from picamera.

SnowLeopard71 avatar SnowLeopard71 commented on April 28, 2024

Thought I'd clarify: Checking the value of cam_alloc_alloc_count will show if the camera is in use whether it by OpenMAX or MMAL libraries. My followup in the thread was unclear in that sense (and a vain attempt to get some kind of fix put into the firmware that prevents a lockup that requires a reboot).
root access is required because read-write access is required on /dev/vc-mem (read only doesn't work). Changing permissions can allow vcdbg to work without requiring root.

from picamera.

waveform80 avatar waveform80 commented on April 28, 2024

Ah, thanks for the clarification! Given that quite a lot of people seem to run python+picamera as root (probably for things like GPIO access), and given the technique would cover MMAL and OpenMAX, I've decided this ought to be reinstated as a goal for 1.0. The root access requirement can be made tentative (much like the led property): if we have access to /dev/vc-mem we can perform the check and bail if it fails, if we don't have access we can fall back to simply guarding against multiple instantiations of the class itself as a best-effort.

from picamera.

waveform80 avatar waveform80 commented on April 28, 2024

Hah! Just as I was coding up stuff for reading the ref-count from /dev/vc-mem I see James' comment on raspberrypi/userland#39 indicating it's fixed in the firmware. I suppose I could still include something for users of older firmware, but to be honest I'd rather encourage people to upgrade to the latest firmware (especially seeing as it fixes a bunch of other issues too)

from picamera.

bennywoochi avatar bennywoochi commented on April 28, 2024

Hello Dave,
I'm using your livestream on the raspberry PI. Everything is working fine. But if I want to make a picture wiht the following command: raspistill -o image.jpg during the live stream is running I get the following error message:

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Can you help me?
Is it possible to create pictures or videos during the livestream?

Thank you!

from picamera.

waveform80 avatar waveform80 commented on April 28, 2024

It is possible, but only from within the same process; i.e. if one process (pistreaming or some picamera script) is using the camera, another process (like raspistill or raspivid) can't. However, the camera can produce JPEGs while recording video as shown in this recipe so if you can adjust your script to do both, you should be good to go.

from picamera.

bennywoochi avatar bennywoochi commented on April 28, 2024

Thank you Dave. In what file I have to add this code?
import picamera

with picamera.PiCamera() as camera:
camera.resolution = (800, 600)
camera.start_preview()
camera.start_recording('foo.h264')
camera.wait_recording(10)
camera.capture('foo.jpg', use_video_port=True)
camera.wait_recording(10)
camera.stop_recording()

Thanks!

from picamera.

waveform80 avatar waveform80 commented on April 28, 2024

Well, it's not quite a matter of just copying and pasting that code somewhere - you need to understand what it does and then use that technique in whatever script you're working with. So, firstly when you say you're using a "livestream" what script is that exactly?

from picamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.