Re: [Vnc2swf-users] Shrinking a vnc2flv file
Status: Alpha
Brought to you by:
euske
From: Brian C. <B.C...@po...> - 2009-11-05 10:32:45
|
On Thu, Nov 05, 2009 at 09:54:11AM +0000, Brian Candler wrote: > I then tried flvrec -K 150 (and no -r flag), and the growth was 147KB > instead of 200KB. So the key frames have some effect it seems. flvrec -B 64 improves it from 200KB to 108KB per 30 seconds. Looking at the source code, every unchanged block in every frame requires something to be written to the output: if (x,y) in changes: # changed block block = zlib.compress(self.screen.get(x,y)) data += pack('>H', len(block)) + block else: # unchanged block data += pack('>H', 0) '>H' is unsigned short (2 bytes). What a shame the zlib compression happens separately per block, instead of once over the whole frame! Anyway, I was thinking that: - a screen of 992x608 is exactly 31x19 blocks (with default blocksize 32) - each frame consists of 31x19x2 = 1178 zero bytes - so 12 fps would be 414KB per 30 seconds That's about twice what I'm seeing, so clearly I've misunderstood something. All those zeros suggests good gzip compression. My original 19MB flv gzips to 9MB, which isn't brilliant but is OK when you consider it contains audio too. I don't know if ffmpeg has a way to set the blocksize and key frame rate parameters when outputting, but if so I could probably shrink this file quite a lot. Unfortunately, ffmpeg appears to be missing the unchanged-block optimisation for flash screen video. If I record a 20-second static screen with vnc2flv, it takes 142K. If I then copy it using ffmpeg -i static-20secs.flv -r 12 -vcodec flashsv static-full.flv it increases to 497K. If I try to halve the image size at the same time using ffmpeg -i static-20secs.flv -s 496x304 -r 12 -vcodec flashsv static-half.flv then it increases to 900K! Regards, Brian. |