June 22, 2009

K-7 as a movie camera -- PART I: The technical foundation

One of the more exciting features of the K-7 is its ability to record video in HD.

I will not repeat the specifications here. But it has an excellent 720p@30Hz recording mode and a 1536x1024p@30Hz mode which is almost full HD and can be used to create FullHD footage. In practice, it writes MJPEG at about 50 MBit/s and therefore can often outperform video recorded in AVCHD.

Many would think that Nikon D90 was the first dSLR sporting HD video. But this is only true 50%. The earlier Pentax K20D already included the ability to record video at 1024p@21Hz, although limited to clips of 5.6s each. So, the video funtion in the K-7 is regarded as already being version 2 by many Pentaxians.

My article about video will come in three parts:

  1. The technical foundation (this part)

  2. Controlling video recording in practice

  3. Samples videos

PART I: The technical foundation

I am the kind of person who needs to look under the hood. Driving is fun. But seeing and grabbing the engine underneath is fun too ;) Read what I've found out.

First of all, video from a dSLR isn't a trivial thing to implement. Of course, one could read out all 14.6 raw million pixels 30 times a second (or at least 24) and construct the corresponding video frames, ideally by supersampling pixels into the smaller size, and compressing to a video codec. But this implies a tremendous processing load (i.e., processing 6.53 GBit/s raw input data in real time!). Implementing it this way (and I think Canon does it this way in their 5DmkII) makes the camera significantly more expensive than would have been required by still photography alone.

Pentax choose to implement it in a way which doesn't increase cost at all. The sensor of the K20D can be read out at a rate of 750+ MBit/s, or 375+ MBit/s per each of its two channels. This is exactly enough to support 3.3 fps at full resolution. In order to support 5.2 fps with the K-7 (seemingly 6.0 fps in the Samsung GX30), Pentax/Samsung doubled the number of channels to four and the K-7 sensor can be read out at a rate of 1.5 GBit/s. As staggering as this figure may seem, it is still only ~20% of what would be required following the approach above. It would have been somewhat easier with a 6 MPixel camera though ;)

Therefore, Pentax created a special subsampling mode where only every 6th raw pixel value is read out from the sensor at 30 Hz. This special signal is always used to create live view, zoomed live view and HD video frames, for all of Pentax K20D (21 Hz), Pentax K-7, Samsung GX20 (21 Hz), Samsung GX30 and Samsung NX' electronic view finder.

Because an HD video has only 2 MPixels (or less) which is about only 1/6th of pixels of a 16:9 still image, this means that at the same ISO step, pixel noise from a video frame and from a still image will look very similiar. Of course, using only every 6th pixel looses 2.5 EV stops in low light performance compared to ambitious supersampling approach. However, even 1/6th of the surface of an APS-C sensor is still a lot larger than the combined surface in dedicated 3 chip HD camcorders. So, videos in low light will look good. It is just that they could look even better.

The subsampling matrix

How are colors reconstructed if only every 6th pixel is read? This is a problem because standard demosaicing techniques as known from a Bayer matrix don't apply. Rather, color is constructed from picking values out of the Bayer matrix with a given color filter. Below is one variant of possible locations where color values are picked from:

(note: if you click onto the image, you can find another variant which most likely would yield better results.)

As you can see, the submatrix forms a pattern repeating every 6x6 pixels. Only 6 pixel values are picked from such a 6x6 area, producing 2 RGB pixels, e.g., as outlined by the black boundaries.

To tell the truth, Pentax applies a little bit of demosaicing magic and produces 4 RGB pixels from the information of 6 raw pixels. However, it does it in a rather bad way leading to the (arti)fact that two horizontally adjacent RGB pixels have very similiar values, almost reducing the advertized resolution of 1536x1024 down to 768x1024. In part three, however, we will see that part of the information is still there. We'll call this effect the "768-aliasing artifact".

Another problem with the subsampling matrix is that colors are spatially translated, i.e., the green channel sits left of the red+blue (=purple) channels within the subsampling matrix. This leads to green fringe where contrast changes from bright to dark (left to right), and purple fringe where contrast changes from dark to bright. You can see the effect in the following image:

(400% crop of a video frame, left from the K-7, right from the K20D)

You can see the fringe effect which is exactly as wide as the 6x3 subsampling matrix (2 pixels in horizontal direction). Also, K20D and K-7 share almost the same subsampling matrix, with a bit less of the "768-aliasing artifact" in the K-7.

There is a simple experiment that demosaicing of the subsampling matrix is very rudimentary indeed: Pierce a tiny hole into a black cardboard, position the K-7 on a tripod ~10 m away and zoom into the hole image using 10x zoomed live view. With a sharp lens, at most a single raw pixel in the subsampling matrix is hit only. What you see on the rear screen, is an image of the hole which is either dim or bright, in an arbitrary color, depending on minor movements of the camera. The hole is dim if a raw pixel which doesn't take part in the subsampling matrix is hit.

So, to summarize, some fringe (false colors) and jaggy edges are artifacts resulting from the way video frames are extracted from the sensor. Note that the effects are much less visible in 720p which is supersampled from the 1526x1024 feed. The K-7's 720p video quality is stunning.

You may look at the 1536x1024 recording quality as being the "raw image equivalent" for 720p final images. Needing post-processing but retaining extra headroom.

Rolling shutter

Another common problem with video in dSLRs is the rolling shutter. Because the mechanical shutter is too slow for 30 fps, it stays open all the time and an electronic shutter is used. In the K-7, the sensor is read-out line by line in progressive order, bottom edge first, within a period of ~1/30s. Because the image is projected head down, the lines at the top of a final image have been read-out earlier than the lines further down. If the camera is panned, e.g., left to right, then vertical lines become slightly skewed, e.g., tilted anti-clockwise. Therefore, this effect is called skewing effect or jello effect as well.

The jello effect does actually bend non-horizontal straight lines if they are rotating with respect to the camera (so, avoid tilting the camera when recording). It can produce funny images with rotating structures, like propellers, actually :)

As for the K-7, this effect is very well controlled. The skew is exact and without extra jagginess. I.e., the read-out is uninterrupted. Very good! If combined with a bit of motion blur, it becomes almost invisible. I would say that the rolling shutter is almost a non-issue with the K-7. Combine this with the lack of motion-compression artifacts and a gray filter maybe, and the K-7 can produce really stunning panning action.

Video compression codec

Another strong point is the selection of high bitrate MJPEG as the compression codec. Not being an amateur's first choice, it offers greater headroom for post-processing. Individual frames are JPEG-compressed and about 200 KBytes large. The JPEG compression artifacts are visible on larger than 100% inspection but don't disturb. Also, MJPEG is an easy format for post-production. And, it doesn't cause extra burden on the in-camera processing engine.

The container is "Motion JPEG OpenDML AVI" and can be opened on all platforms, e.g., using Apple Quicktime. Of course, for long-term archival, MJPEG needs to be recoded (e.g., to MP4 AVC) to save space.


The K-7 has a built-in mono microphone capturing a clear sound in the absence of any wind.

It does have a plug for a stereo microphone too. I tried the RĂ˜DE Stereo VideoMic connected to the flash hot shoe and it produces excellent results.

It plays back audio over the built-in speaker which is really bad, though ;) For decent audio in the field, one would require an HDMI-capable field monitor with a headphone jack. Yes, I checked that audio is played back via HDMI.

The audio quality seems to be good too. The format is 1 or 2 channels of 16 Bit, 32 kHz PCM.


After 5 - 30 minutes of continued video recording, a red thermometer pops up on the rear screen and informs about increasing temperature. I didn't have any recording stopped by temperature alert. But it may be a concern in very hot regions, full sun shine and for extended scene recording.

(Update) I've test-driven continuous video recording at 27°C ambient temperature for 40 minutes. The red thermometer appeared after about 15 minutes. But the camera didn't interrupt. The camera felt warm and burned one out of three battery marks.

A still image shot at the end was ISO 800 and 40°C. It shows a very faint vertical line in the middle, about as pronounced as the ISO800 noise and only visible against a uniform background at 100%, invisible in normal photography. Even invisible against the uniform background are additional vertical lines exactly 256 pixels apart. I don't consider this hot temperature banding to be significant considering it is from a pre-production sensor.

Other observations: right after movie recording with temperature alert, the camera refuses to enter LV but still enters movie mode and continues recording movies (or allows still images using the viewfinder). Only 20s after movie recording, it accepts LV again, incl. the red thermometer. After 2 minutes, the red thermometer has disappeared.

I think at below 30°C ambient temperature, it won't emergency-break a movie recording. (end of update)

This shall conclude Part I. Next will be a discussion about making the K-7 video feature more accessible for real projects.

-> Continue to part II


  1. This is a great article. I'me eager to read the next parts.

    A little question : is audio monitoring using hdmi available *when* recording?

  2. Yes. In the video in part II, you can hear a "hall" atmosphere because sound is recorded twice. HDMI transmits video AND audio while recording.

  3. It seems all the DSLRs (Nikon D90, Pentax K7 AND Canon 5dm2) all implement video by decimating pixels.
    click the link under samusan to see thread with images showing aliasing in 5dm2 video.

  4. I have a K-7 and here is mine problem
    at the highest resolution 1526x1024 HQ movies takes less space than on 1280x720 HQ! I'm puzzled and can't explain this.
    Does Pentax use higher compression at 1024 or at 720 some sharpening is added or ??

    This is 100% true since I have 3 8GB card a none of then can record without interputions at 720 highesst settigns but 2 can do at 1024 highest settings. I tested this with noisy low light condition to push up the bit rate


Please if posting anonymously, choose a nickname for your post. Thanks.