[FFmpeg-trac] #3947(avcodec:open): Inconsistent and confusing setting of refs with libx264

FFmpeg trac at avcodec.org
Sat Sep 13 14:28:26 CEST 2014

#3947: Inconsistent and confusing setting of refs with libx264
             Reporter:               |                    Owner:
  francois.visagie@…                 |                   Status:  open
                 Type:  defect       |                Component:  avcodec
             Priority:  normal       |               Resolution:
              Version:  git-master   |               Blocked By:
             Keywords:  libx264      |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  0            |

Comment (by francois.visagie@…):

 Replying to [comment:1 Timothy_Gu]:
 > To adjust level through `-x264opts`, we will have to make a special case
 as x264 requires some further configuration else than just setting the
 level in the context. Or it could be fixed on the x264 side.

 Since '-level x.y' seems to correctly set that configuration - including
 refs - is there the possibility that the handling of '-x264opts level=x.y'
 could be directed to that of '-level x.y'?

 In any case, while I'm not able to analyse the code, for three reasons
 there does seem to be the possibility that the further configuration is
 correctly set by '-x264opts level', but (accidentally) partially
 overwritten by ffmpeg subsequently. 1) 'x264 --level' correctly sets the
 level-specific configuration, including refs, which creates the
 possibility that libx264 might do the same. 2) When not given a '-refs'
 value, ffmpeg always defaults to 16. 3) All encodes done with '-x264opts
 level' and without '-refs' have refs=16. Together these give rise to the
 possibility that when '-x264opts level' is used, libx264 correctly sets
 the configuration, but that ffmpeg subsequently overwrites refs with its
 default of 16.

 If that is the case, ffmpeg's logic could be changed to not pass a refs
 value to libx264 when either of '-level' or '-x264opts level' is used, and
 no '-refs' value is provided.

 If that is not the case but ffmpeg somehow needs to anticipate the level
 and/or level-specific maxrefs level libx264 will need, you could refer to
 the calculations in attachment

 > On the other hand, `-level` documentation should be fixed.

 Please. At the moment it only says
 level integer (encoding,audio,video)

     Possible values:

 Apart from missing possible values etc., it should mention whether this
 option takes into account x264's handling of refs wrt. bframes and
 b-pyramid [http://forum.doom9.org/showthread.php?t=142758].

Ticket URL: <https://trac.ffmpeg.org/ticket/3947#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list