[FFmpeg-devel] [RFC] scenechange_score in AVCodecContext?

Stefano Sabatini stefano.sabatini-lala
Mon Nov 19 17:35:22 CET 2007


On date Sunday 2007-11-18 01:27:21 +0100, Michael Niedermayer encoded:
> On Thu, Nov 15, 2007 at 03:07:47PM +0100, Stefano Sabatini wrote:
> > On date Thursday 2007-11-15 03:11:54 +0100, Michael Niedermayer encoded:
[...]
> > > you cannot add anything in the middle it breaks the ABI
> > > also id like to see some examples where this is usefull/needed
> > > iam not in favor of exporting stuff just because it can be exportet
> > > there should be some sense in it
> > 
> > Consider this scenario: real-time streaming of impredictable
> > application dependant video content. It would be useful to change the
> > encoding parameters (rate control, frame rate, etc.) in function of
> > the *features* of the video streamed (I'm not sure if is possible to
> > change the parameteres of the avcodec context on the fly at all).
> 
> this belongs into libavcodec not in the application, other applications
> could benefit from such things as well
> also we already export motion vectors, macroblock types and the picture
> type

IMHO adaptive encoding should be left to the application level (for
example when adapting the video size/framerate), this to avoid to
bloat libavcodec and to avoid problems when interacting with
libavformat, not every format supports variable framerate and size,
which isn't a problem when the images are sent not embedded in a
container. But we could define a mechanism to easily hook a user
defined adaptation mechanism.

> and scenechange_score does not belong in AVCodecContext but AVFrame

Agree with this, see the patch attached.

BTW, I tested the behaviour with a silent video, obtaining these weird
results:

./ffmpeg -i silence.mpeg -s ${size}x${size} -vstats_file vstats -r 30 -y test.avi; less vstats

size                 average_P_frame_scenechage_score
8                    -7
16                   -7
32                   -28
64                   16
128                  -448
256                  256
512                  ~-3020

When encoding with size 64 and 256 and with the default value of
scenechange_score_threshould every frame is encoded as an I-frame. Is
this to a be considered a bug?

Thanks again for your time and attention.
Best regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: define-scenechange-score-in-avframe-00.patch
Type: text/x-diff
Size: 2253 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071119/c7ed8c26/attachment.patch>



More information about the ffmpeg-devel mailing list