fast video encoding

Rhodri James rhodri at
Tue Aug 4 00:24:04 CEST 2009

On Sun, 02 Aug 2009 03:44:17 +0100, sturlamolden <sturlamolden at>  

> On 29 Jul, 10:14, gregorth <gregor.thalham... at> wrote:
>> for a scientific application I need to save a video stream to disc for
>> further post processing.
> I have worked a bit on this as well. There are two things that make
> scientific applications different form common video encoding:
> First, a scientific video stream is often very different from a
> 'movie': There are usually very little 'movement'. For example, when I
> have filmed a mouse swimming in a water maze (a pool of milky white
> water), the only thing that moves is the rat. So I could achieve
> excellent compression just by saving the pixels that changed.

These are referred to as P-frames; any encoder that gets further than
the most basic version of any video protocol will do this for you.
Unfortunately, water pixels change a lot from frame to frame, even
when the camera is static, so it doesn't gain you as much as you might
hope in cases like you mention.

> Second, scientific data should be stored with lossless compression if
> possible.

If data storage is no object, be my guest.  Of course, you're going to
have to write your own codecs for this, since pretty much every video
protocol in existence is lossy.

In reality, lossless compression isn't necessary.  As long as your
quantisation isn't completely up the spout, the added precision isn't
actually going to gain you anything unless you're working in very
specialised situations; even then, if it does make a significant
difference then you needed greater resolution anyway.

Rhodri James *-* Wildebeest Herder to the Masses

More information about the Python-list mailing list