Opened 11 months ago

Closed 3 months ago

Last modified 3 months ago

#6264 closed enhancement (invalid)

Strange performance results

Reported by: zezinho Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: vaapi
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Encoding with VAAPI is much slower if sound is converted. Launching another ffmpeg dedicated to the sound conversion gives much better results.

The test was done with 9th generation Intel HD500 in a Celeron N3350 and a 1080p@24 and 18Mb/s file.

With the example below, I get 60fps so it is 2.42x speed. Removing the acodec copy option, it is converted to vorbis, speed drops to 42fps (1.41x).

The strange point is that launching another simultaneous ffmpeg to drops the video and converts to vorbis, I get normal speed for this CPU : 5.5x and the other ffmpeg keeps at 2.42x.

So it seems using VAAPI along with Vorbis slows down both codecs.

How to reproduce:

% ffmpeg \
  -hwaccel vaapi \
  -vaapi_device /dev/dri/renderD128 \
  -i input.mkv \
  -vf 'format=nv12,hwupload,scale_vaapi=w=1366:h=768' \
  -vcodec h264_vaapi \
  -acodec copy \
  -qp 23 \
  output.mkv
ffmpeg version 3.2.4
built on gcc 5.4.0 (Mageia 6 package)

Change History (6)

comment:1 follow-up: Changed 11 months ago by cehoyos

  • Keywords vaapi added

Is this issue reproducible with current FFmpeg git head?

comment:2 in reply to: ↑ 1 ; follow-up: Changed 11 months ago by zezinho

Replying to cehoyos:

Is this issue reproducible with current FFmpeg git head?

Sorry, I have no easy way to try on git version. But it is version 3.2.4 that I have used, even if it is not avaliable in TRAC menu...

comment:3 in reply to: ↑ 2 ; follow-up: Changed 11 months ago by cehoyos

Replying to zezinho:

Replying to cehoyos:

Is this issue reproducible with current FFmpeg git head?

Sorry, I have no easy way to try on git version.

Why?
Are there no FFmpeg binaries offered for your operating system?

comment:4 in reply to: ↑ 3 Changed 11 months ago by zezinho

Replying to cehoyos:

Replying to zezinho:

Replying to cehoyos:

Is this issue reproducible with current FFmpeg git head?

Sorry, I have no easy way to try on git version.

Why?
Are there no FFmpeg binaries offered for your operating system?

Unfortunately, they have no VAAPI enabled :

ffmpeg version N-83692-gb8a7dcbde2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers

built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 47.100 / 55. 47.100
libavcodec 57. 81.100 / 57. 81.100
libavformat 57. 66.102 / 57. 66.102
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100

[AVHWDeviceContext @ 0x4a61ec0] No VA display found for device: /dev/dri/renderD128.
[vaapi @ 0x312f1e0] Failed to create a VAAPI device

comment:5 Changed 3 months ago by jkqxz

  • Resolution set to invalid
  • Status changed from new to closed

This is an expected consequence of the single-threaded nature of the ffmpeg utility combined with synchronous behaviour in the Intel VAAPI driver (it doesn't use the CPU while encoding, but it still blocks the calling thread waiting for it to finish).

comment:6 Changed 3 months ago by cehoyos

  • Version changed from 3.2.1 to unspecified
Note: See TracTickets for help on using tickets.