[FFmpeg-trac] vaapi acceleration and jerky videos

Mani Vannan M. vannan.mani at gmail.com
Tue Oct 25 13:33:44 EEST 2016


Hi

I have seen one post about hevc_vaapi acceleration and subsequent jerky
results.
The non accelerated version of hevc (x265) produces clean output, while the
hevc_vaapi encoded version gives a jerky output. The encoding does not
produce any errors, no overruns/underruns, except that the output is jerky.

the 264_vaapi does not produce any jerky output, its only with hevc_vaapi

I believe this has been reported before, but seems to have caught nobodys
attention, can anybody please help with this.

The ffmpeg command, vainfo and mediainfo for the input and the encoded
ouptut file are below

ffmpeg -i input.mp4 -vaapi_device /dev/dri/renderD128 -c:v hevc_vaapi
-preset medium -vf 'format=nv12,hwupload' output.mp4
ffmpeg version N-81582-g38445d5 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
  configuration: --prefix=/home/pas/ffmpeg_build
--pkg-config-flags=--static --extra-cflags=-I/home/pas/ffmpeg_build/include
--extra-ldflags=-L/home/pas/ffmpeg_build/lib
--extra-cflags=-I/home/pas/includes/include
--extra-ldflags=-L/home/pas/includes/include --bindir=/home/pas/bin
--enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libx265 --enable-decklink
--enable-vaapi --enable-nonfree
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.102 / 57. 48.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 61.100 /  6. 61.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 03:08:36.02, start: 0.000000, bitrate: 8495 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
bt709), 1920x1080 [SAR 1:1 DAR 16:9], 8360 kb/s, 24 fps, 24 tbr, 90k tbn,
48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1,
fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Codec AVOption preset (Set the encoding preset (cf. x264 --fullhelp))
specified for output file #0 (output.mp4) has not been used for any stream.
The most likely reason is either wrong type (e.g. a video option with no
video streams) or that it is a private option of some encoder which was not
actually used for any stream.
[mp4 @ 0x2cb2040] Using AVStream.codec to pass codec parameters to muxers
is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.48.102
    Stream #0:0(und): Video: hevc (hevc_vaapi) (Main) ([35][0][0][0] /
0x0023), vaapi_vld, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 12288
tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.55.101 hevc_vaapi
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
5.1, fltp, 341 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.55.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_vaapi))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=  601 fps= 90 q=-0.0 Lsize=    5643kB time=00:00:25.23
bitrate=1831.8kbits/s speed=3.79x
video:5072kB audio:554kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.297877%

$ vainfo
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :    VAEntrypointVLD
      VAProfileMPEG2Simple            :    VAEntrypointEncSlice
      VAProfileMPEG2Main              :    VAEntrypointVLD
      VAProfileMPEG2Main              :    VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointVLD
      VAProfileH264Main               :    VAEntrypointEncSlice
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileH264High               :    VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      :    VAEntrypointVLD
      VAProfileH264MultiviewHigh      :    VAEntrypointEncSlice
      VAProfileH264StereoHigh         :    VAEntrypointVLD
      VAProfileH264StereoHigh         :    VAEntrypointEncSlice
      VAProfileVC1Simple              :    VAEntrypointVLD
      VAProfileVC1Main                :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
      VAProfileNone                   :    VAEntrypointVideoProc
      VAProfileJPEGBaseline           :    VAEntrypointVLD
      VAProfileJPEGBaseline           :    VAEntrypointEncPicture
      VAProfileVP8Version0_3          :    VAEntrypointVLD
      VAProfileVP8Version0_3          :    VAEntrypointEncSlice
      VAProfileHEVCMain               :    VAEntrypointVLD
      VAProfileHEVCMain               :    VAEntrypointEncSlic


the input file from mediainfo

mediainfo input.mp4
General
Complete name                            : input.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 11.2 GiB
Duration                                 : 3h 8mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 8 496 Kbps
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Writing application                      : Lavf56.40.101

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High at L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 3h 8mn
Bit rate mode                            : Variable
Bit rate                                 : 8 361 Kbps
Maximum bit rate                         : 35.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.168
Stream size                              : 11.0 GiB (98%)
Writing library                          : x264 core
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 3h 8mn
Duration_LastFrame                       : -11ms
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Channel(s)_Original                      : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 173 MiB (2%)
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

$ mediainfo output.mp4
General
Complete name                            : output.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 5.51 MiB
Duration                                 : 25s 259ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 830 Kbps
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Writing application                      : Lavf57.48.102

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 25s 42ms
Bit rate                                 : 1 659 Kbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.033
Stream size                              : 4.95 MiB (90%)
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 25s 259ms
Bit rate mode                            : Variable
Bit rate                                 : 180 Kbps
Maximum bit rate                         : 341 Kbps
Channel(s)                               : 2 channels
Channel(s)_Original                      : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 554 KiB (10%)
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

Some body please have a look into this please.

Best Regards
Mani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/ffmpeg-trac/attachments/20161025/76895e43/attachment.html>


More information about the FFmpeg-trac mailing list