6

Picamera records by default at 1920*1080 resolution (Full HD) and it is very clear. But all the videos are compressed using h264 (MPEG-4) codec.

Can I get the uncompressed video recording since the experiment that I'm doing might not work if the video recording is compressed. Is there a way to capture the Raw video without any compression?

3

The picamera library permits unencoded video recording and image capture by specifying a format like yuv or rgb. See the start_recording method for details.

That said, I'd be very surprised if you could record such a stream at 1080p to the SD card. For example, let's assume you've got a class 10 card (i.e. one capable of writing 10MB/s). At 1080p (1920x1080 at 30fps) with RGB (3 bytes per pixel) format you'll need to transfer:

1920 * 1080 * 3Bpp * 30fps = 177MB/s

Even if you go with YUV which cuts pixel size down to 1.5 bytes per pixel you'll still need 89MB/s. Given those numbers it's unlikely you'd even be able to pipe frames over the LAN. The only way to get it close to 10MB/s is to cut down the resolution or reduce the framerate.

In other words, you'd be much better off experimenting with an H.264 stream first to see if it's good enough (I'm always wary of claims that things won't be good enough without actual experience to back them up). Switching from an H.264 stream to an unencoded stream is trivial (at least on the picamera side), although you'd then need to tackle the question of bandwidth...

  • So I do: camera.start_recording('video.data', 'yuv') But My camera gets hanged. Is this due to Bandwidth constraint? How can I solve that? – Coderaemon Feb 2 '15 at 12:17
  • I would suggest using a lower resolution and/or frame rate, and if possible use YUV format as it requires half the bandwidth of RGB – Dave Jones Feb 2 '15 at 13:28
  • Yes I am using very minimal resolution (64,48) just to check, still the camera doesn't respond. Guess I would have to go with H264 only. I am using 'yuv' format only. – Coderaemon Feb 3 '15 at 5:42
  • Hmm ... that should work happily. The test suite for picamera does include tests for the formats yuv, rgb, and rgba including recording to files and streams, at a number of resolutions including 1080p (although not for long - I think 2 seconds is the length of time it typically records in order to keep the test suite's runtime reasonable). If you're still having problems, do feel free to open a ticket on the picamera GitHub repository. – Dave Jones Feb 3 '15 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.