Opened 7 months ago

Last modified 6 months ago

#10622 open defect

AMF encoder uses sleep() function, which is not precise on WIndows

Reported by: Evgeny Owned by: Evgeny
Priority: important Component: avcodec
Version: git-master Keywords: AMF encoder
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

  1. AMF encoder has av_usleep(1000) when AMF encoder input queue is full.
  2. Inside av_usleep() function the standalone “sleep()” function is used, which is not very accurate on windows OS. For a sleep of 1 ms, we observe an actual sleep time of 13 to 14ms.
  3. For low resolution encoding (e.g. 480x360 video) av_usleep() executes frequently, so performance degradation is quite big (about 15%).
  4. We will create a patch for fix this performance degradation by changing av_usleep(1000) -> av_usleep(0) on Windows OS.


How to reproduce:

% ffmpeg.exe -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -c:v h264_amf out.mp4
ffmpeg master branch
built on Windows

Change History (3)

comment:2 by Evgeny, 7 months ago

Owner: set to Evgeny
Status: newopen

comment:3 by Aleksoid1978, 6 months ago

For Windows better way - use NtQueryTimerResolution/NtSetTimerResolution functions for set accurate timer ~1ms.

Note: See TracTickets for help on using tickets.