Comments (8)
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.
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.
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.
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.
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.
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.
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.
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)
- Easy way to tap off frames pre-encoding
- python3-picamera package depends on python3-numpy
- What is the default intra-frame period? HOT 2
- Limited running time HOT 1
- Not supported in bullseye Raspberry Pi OS version HOT 3
- Jumping exposure time on Raspberry Pi HQ camera HOT 1
- [Docmentation] How to find out the Bayer pattern from the CFA layout HOT 2
- Can one access both frames from the OPQV-dual stream and output the difference in real time? HOT 2
- libmmal.so: cannot open shared object file: No such file or directory HOT 6
- Frame freezes whilst try display/save high resolution frame HOT 1
- shutter_speed TypeError HOT 12
- Cannot install on development machine
- No such file or directory HOT 1
- PiCamera start_preview blocks indefinitely
- Realtime Motion Detection Latency
- Camera eposure time doubled from shutter speed?
- Is the `PiBayerArray.flush` method unpacking data correctly?
- 4.16. Raw Bayer data captures - Example Code - Assertion Error
- mjk
- stereo mode: how to switch camera sides HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picamera.