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

Michael Niedermayer michaelni
Mon Nov 19 19:08:46 CET 2007


On Mon, Nov 19, 2007 at 05:35:22PM +0100, Stefano Sabatini wrote:
> 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.

adapting the framerate or resolution (reduced resolution in mpeg4 if we
did support that) to conform to VBV constraints is lavc job and cannot
be done in the application

either way scenechange_score is an internal parameter and its exact
definition that is the algorithm to calculate it can change at any time
it is not appropriate for being used by an application for making
framerate, resolution or other decissions


> 
> > 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?

you would have to provide complete information so we can reproduce it
before i can awnser that

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071119/b33c2926/attachment.pgp>



More information about the ffmpeg-devel mailing list