[FFmpeg-devel] flashsvenc.c - sampling block size too low

Jason Askew jason.askew
Fri May 18 03:24:42 CEST 2007


> could you please explain what exactly this patch is doing?
>

Block size can only be changed at i-frame boundaries.

It is not known ahead of time what the optimal block code for a given
i-frame group is going to be.

My code keeps track of the total encoding size since the last i-frame
for each of the possible block sizes.  When the next i-frame is
encountered, the smallest encoded block size is written to the log
file.  On the second pass, this block size is then used to encode that
i-frame section, resulting in the smallest possible file size.

I interacted with Benjamin Larsson to get his permission to extend his
code and to make sure this was the correct route.


> the current flashsvenc.c contains a optimal brute force encoder
> which tries all block sizes, it is under #if 0 and works with
> a single pass, and assuming it is not buggy it should outperform
> your code, which adapts the blocks at coarser granularity
>
> and your patch duplicates alot of the existing code ...
>

The #if 0 code does not work.  Block size can be changed only at
i-frame boundaries.  flv's encoded with #if 0 code does not play back
correctly.

And yes, my code is current based on the concept introduced on the #if
0 code.  I am working on a very promising algorithm now that is 3-4
times faster than the brute force method.




More information about the ffmpeg-devel mailing list