Coder Social home page Coder Social logo

Comments (4)

waveform80 avatar waveform80 commented on April 28, 2024

Okay, I've figured this one out now. The problem isn't so much split_recording, but split_recording after a video-port still capture has been taken. Eliminate the video-port still capture and split_recording works fine. In 1.1, some code was introduced that causes the encoder classes to explicitly stop the camera from capturing once a frame has been received (this change was partly made to fix some issues with raw captures returning much more data than they should). However, this also means that as the video recording and video-port based captures share a camera port, the capture method is stopping the camera port that the continuing video recording is relying on.

A simple workaround for anyone desperate for one is to delete (or comment out) lines 328-331 in encoders.py (which will be in /usr/share/pyshared/picamera, or /usr/local/lib/python2.7/picamera depending on how you installed):

            mmal_check(
                mmal.mmal_port_parameter_set_boolean(
                    self.camera_port, mmal.MMAL_PARAMETER_CAPTURE, mmal.MMAL_FALSE),
                prefix="Failed to stop capture")

This will fix taking video-port based captures and then using split_recording, but will also reintroduce the issue with raw captures mentioned above. I'll try and figure out something which will fix both problems tonight/this weekend and get out a new release ASAP.

from picamera.

jbeale1 avatar jbeale1 commented on April 28, 2024

Using the current picamera, in particular camera.record_sequence(), I am sometimes seeing this error 'Timed out waiting for an SPS header' as mentioned here: http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=56478&start=225#p543593
it seems to happen more often at low framerates, like fps = 5, and with VBR. I did not see it with fixed bitrate at fps = 25.

from picamera.

waveform80 avatar waveform80 commented on April 28, 2024

Interesting - at the moment, picamera has a hard-coded limit of 10 seconds (which I picked arbitrarily) before it'll give up waiting for an SPS header (which indicates a valid split point). I added the limit after experiencing a few hangs with split_recording in testing (various configurations, like VBR, fail to produce SPS headers with the current firmware so this was simply added to ensure my test suite would actually finish most of the time!). 10 seconds seemed reasonable for 30fps (and above) but I didn't consider recording with slower speeds. The timeout should really be based on the camera's configured framerate and the intra_period (as SPS headers always precede an I-frame as far as I can tell). I'll open a ticket for this as it shouldn't be too hard to add. In the meantime, try experimenting with the intra_period parameter as that should be able to provide a work-around (albeit at the cost of more I-frames and therefore less compression).

from picamera.

jbeale1 avatar jbeale1 commented on April 28, 2024

Thanks for looking into it. I thought the code would wait for a certain fixed number of frames, rather than a certain number of wall-clock seconds. But if you know what the encoder's intra-period is, I guess that is the real limit.

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.