[FFmpeg-trac] #6276(avcodec:new): h264_vaapi & nvenc do not preserve aspect ratio changes

FFmpeg trac at avcodec.org
Wed Nov 13 09:23:13 EET 2019


#6276: h264_vaapi & nvenc do not preserve aspect ratio changes
-------------------------------------+-------------------------------------
             Reporter:  Tom_B        |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  vaapi nvenc  |               Blocked By:
  aspect                             |
             Blocking:               |  Reproduced by developer:  1
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by fulinjie):

 * cc: linjie.fu@… (added)
 * reproduced:  0 => 1


Comment:

 The sync Surface error seems to be relevant with the input clips.
 The last several frames of aspect_ratio_change_cut.ts is not good.

 Simply cut these frames and the reported description could be observed.

 {{{
 ffmpeg -i aspect_ratio_change_cut.ts -c:v copy -vframes 80
 80_aspect_ratio_change_cut.h264
 }}}


 No aspect ratio change with vaapi encode:

 {{{
 ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi  -i
 80_aspect_ratio_change_cut.h264  -y -g 30 -vf 'format=nv12,hwupload' -c:v
 h264_vaapi -qp 20 -sn out.ts
 }}}




 Aspect ratio change observed with x264:
 {{{
 ffmpeg -hwaccel vaapi  -i 80_aspect_ratio_change_cut.h264  -y -g 30  -c:v
 libx264 -qp 20 -sn out_x264.ts
 }}}


 In libx264, reconfig_encoder() modified the SPS during encoding procedure
 when sample_aspect_ratio changes.

 https://github.com/fulinjie/ffmpeg/blob/87ddf9f1ef17726fd4235f2e7aed8334d0ff231b/libavcodec/libx264.c#L198

 Similar behavior could be added in VAAPI.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6276#comment:11>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list