[FFmpeg-trac] #8376(avcodec:new): hevc_vaapi loses aspect ratio during encoding

FFmpeg trac at avcodec.org
Mon Nov 11 17:11:35 EET 2019


#8376: hevc_vaapi loses aspect ratio during encoding
-------------------------------------+-------------------------------------
             Reporter:  yurtesen     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avcodec      |                  Version:  4.1.4
             Keywords:  vaapi, amd,  |               Blocked By:
  hevc, aspect, mesa, radeon         |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 I am using ffmpeg version 4.1.4-1build2 with Radeon RX570 which supports
 HEVC encoding through VAAPI. I can test a more recent build if required.

 When VAAPI is used the aspect ratio setting is lost. 720x576 (AR 16:9)
 video enters and output is only 720x576. So the players show it with wrong
 aspect ratio.

 Using --aspect option does not seem to have any effect output file.

 {{{
 libva info: VA-API version 1.5.0
 libva info: va_getDriverName() returns 0
 libva info: Trying to open /usr/lib/x86_64-linux-
 gnu/dri/radeonsi_drv_video.so
 libva info: Found init function __vaDriverInit_1_5
 libva info: va_openDriver() returns 0
 vainfo: VA-API version: 1.5 (libva 2.5.0)
 vainfo: Driver version: Mesa Gallium driver 19.2.1 for Radeon RX 570
 Series (POLARIS10, DRM 3.33.0, 5.3.0-19-generic, LLVM 9.0.0)
 vainfo: Supported profile and entrypoints
       VAProfileMPEG2Simple            : VAEntrypointVLD
       VAProfileMPEG2Main              : VAEntrypointVLD
       VAProfileVC1Simple              : VAEntrypointVLD
       VAProfileVC1Main                : VAEntrypointVLD
       VAProfileVC1Advanced            : VAEntrypointVLD
       VAProfileH264ConstrainedBaseline: VAEntrypointVLD
       VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
       VAProfileH264Main               : VAEntrypointVLD
       VAProfileH264Main               : VAEntrypointEncSlice
       VAProfileH264High               : VAEntrypointVLD
       VAProfileH264High               : VAEntrypointEncSlice
       VAProfileHEVCMain               : VAEntrypointVLD
       VAProfileHEVCMain               : VAEntrypointEncSlice
       VAProfileHEVCMain10             : VAEntrypointVLD
       VAProfileJPEGBaseline           : VAEntrypointVLD
       VAProfileNone                   : VAEntrypointVideoProc
 }}}


 Here is a 6MB test file (720x576 (AR 16:9)) (~6mb)
 https://drive.google.com/file/d/1-IDAYhfj93aPJPizWKttpfGV-KVPKKSx/view

 The output file ends up as (720x576) only without AR setting. (~1mb)
 https://drive.google.com/file/d/1mHbzcrAbN2zHVCgEkUTlqTDyCyC6yvPw/view

 How to reproduce:
 {{{
 /usr/bin/ffmpeg -vaapi_device /dev/dri/renderD128 -i yks.ts -vf
 'yadif,format=nv12,hwupload' -c:v h264_vaapi -c:a copy out.ts
 ffmpeg version 4.1.4-1build2 Copyright (c) 2000-2019 the FFmpeg developers
   built with gcc 9 (Ubuntu 9.2.1-4ubuntu1)
   configuration: --prefix=/usr --extra-version=1build2
 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
 --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
 --disable-stripping --enable-avresample --disable-filter=resample
 --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom
 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
 --enable-libcdio --enable-libcodec2 --enable-libflite --enable-
 libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme
 --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa
 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-
 libpulse --enable-librsvg --enable-librubberband --enable-libshine
 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-
 libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-
 libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi
 --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2
 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-
 chromaprint --enable-frei0r --enable-libx264 --enable-shared
   libavutil      56. 22.100 / 56. 22.100
   libavcodec     58. 35.100 / 58. 35.100
   libavformat    58. 20.100 / 58. 20.100
   libavdevice    58.  5.100 / 58.  5.100
   libavfilter     7. 40.101 /  7. 40.101
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  3.100 /  5.  3.100
   libswresample   3.  3.100 /  3.  3.100
   libpostproc    55.  3.100 / 55.  3.100
 [mpegts @ 0x560df48a61c0] PES packet size mismatch
 Input #0, mpegts, from 'yks.ts':
   Duration: 00:00:10.85, start: 31818.542544, bitrate: 5027 kb/s
   Program 1
     Metadata:
       service_name    : Liv
       service_provider: Nelonen
     Stream #0:0[0x204]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
 yuv420p(tv, bt470bg, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25
 tbr, 90k tbn, 50 tbc
     Stream #0:1[0x2b2](fin): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
 stereo, s16p, 192 kb/s
 File 'out.ts' already exists. Overwrite ? [y/N] y
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_vaapi))
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [h264_vaapi @ 0x560df48adc80] Driver does not support some wanted packed
 headers (wanted 0xd, found 0).
 Output #0, mpegts, to 'out.ts':
   Metadata:
     encoder         : Lavf58.20.100
     Stream #0:0: Video: h264 (h264_vaapi) (High), vaapi_vld, 720x576 [SAR
 64:45 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.35.100 h264_vaapi
     Stream #0:1(fin): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
 stereo, s16p, 192 kb/s
 [mpegts @ 0x560df48a61c0] PES packet size mismatch:00:10.52
 bitrate=2790.9kbits/s speed=6.98x
 frame=  261 fps=168 q=-0.0 Lsize=    3942kB time=00:00:10.80
 bitrate=2990.2kbits/s speed=6.95x
 video:3372kB audio:248kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 8.896013%
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8376>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list