Re: [Vnc2swf-users] Shrinking a vnc2flv file
Status: Alpha
Brought to you by:
euske
From: Brian C. <B.C...@po...> - 2009-11-06 22:33:10
|
On Fri, Nov 06, 2009 at 04:19:58PM +0000, Brian Candler wrote: > Taking my 19MB vnc2flv file, and using ffmpeg built from SVN: > > ffmpeg -i src.flv -vcodec flashsv -acodec copy -r 12 -g 120 same.flv > > gives a file which is 13.5MB. This reduction is because ffmpeg is outputting using 64x64 blocks, rather than the 32x32 that you get by default from vnc2flv. As a result, the space used by idle frames is only about 1/4. > And scaling it down by 2:1 at the same time, > > ffmpeg -i src.flv -vcodec flashsv -acodec copy -s 496x304 -r 12 -g 120 half.flv > > gives a file which is 11.7MB. Remember this includes audio too. I am still a > bit surprised that the resizing doesn't reduce the output much ffmpeg does an very good job of antialiasing the reduced image (even text is legible at half size), and the resulting frames don't compress very well in zlib because of the number of different colours used. I made a simple trick in ffmpeg to quantize to 16 levels of R/G/B: --- libavcodec/flashsvenc.c.orig 2009-11-06 22:13:00.000000000 +0000 +++ libavcodec/flashsvenc.c 2009-11-06 22:13:19.000000000 +0000 @@ -88,7 +88,7 @@ npfptr = pfptr+(i*stride)+dy*3; for (j=0 ; j<w*3 ; j++) { diff |=npfptr[j]^nsptr[j]; - dptr[j] = nsptr[j]; + ((nsptr[j] + 8)/ 17) * 17; } dptr += w*3; } My test file has a video portion of 10543K. When scaling to half size, it only shrunk to 9048K. However with the above patch, it reduced to 4086K, and the total size of the flv with audio was 6.9M. Perhaps I'll propose a flag on the ffmpeg list. Regards, Brian. |