Opened 16 months ago
Last modified 16 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:
- AMF encoder has av_usleep(1000) when AMF encoder input queue is full.
- 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.
- For low resolution encoding (e.g. 480x360 video) av_usleep() executes frequently, so performance degradation is quite big (about 15%).
- 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:1 by , 16 months ago
comment:2 by , 16 months ago
Owner: | set to |
---|---|
Status: | new → open |
comment:3 by , 16 months ago
For Windows better way - use NtQueryTimerResolution/NtSetTimerResolution functions for set accurate timer ~1ms.
Note:
See TracTickets
for help on using tickets.
Fix for this issue:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20231016091402.7972-1-lucenticus@gmail.com/