TheAlbatross wrote:With all due respect, of course -- I don't know for sure. But I don't think the SD card's bandwidth is the bottleneck. I think I have read that the write-speed of the SD card is faster than an internal Pi bottleneck, in capturing information from the camera. I hope a wiz will clarify (or correct me!).
If the SD card in the example isn't the bottleneck ... how does the write speed nearly double when switching the output from an actual file to /dev/null? I'm afraid the SD card is a very real bottleneck in terms of IO.
On the subject of how the SD card IO is wired, it's not via USB but direct to the CPU
. Also bear in mind that the Pi doesn't support UHS signalling
, and as that last post suggests, the bandwidth claims of SD card classes are often so much marketing waffle, which is most likely why my class 10 card above is achieving nowhere near 10Mb/s (it's more like 4.5Mb/s). Although, in its defence, it's a pretty heavily used card (it's been in my development Pi for a good year now!)
On Python's overhead - very much depends what you're doing. If it's pure IO (which is more or less what the example above is doing), there's very little. Most of Python's IO stuff is written in C, and as long as you're just throwing pointers to memory around (which is mostly what picamera does) without allocating and copying stuff (tricky to tell in Python sometimes), it's pretty fast. For example, the library has no trouble keeping up with callbacks from the H.264 encoder when it's recording at 90fps.
That in turn suggests to me that the halved framerate issue mentioned in that SO answer is something related to the triggering of the capture rather than the IO side of things, but I haven't tested that. I vaguely recall in the early days of picamera development I could capture frames at the full framerate from the video port, and at some point in recent development I found the rate had halved - but whether that was due to a change in firmware or the library I've no idea (unfortunately I've no idea when I'll have time to delve into this, but it's an interesting question).