[FFmpeg-devel] [PATCH, v2] avcodec/amfenc: increase precision of Sleep() on Windows
Araz
primeadvice at gmail.com
Mon Sep 9 19:05:38 EEST 2024
>
> > I took a look at this using AMD's AMF EncoderLatency sample and found
> that
> > setting the QUERY_TIMEOUT option to 50 ms (as is default for the new AMF
> > HQ and HQLL usage values) results in latency that is better than the
> > current AMF code in FFmpeg *and* this patch without having to touch
> > the process's timer precision.
> >
> > Here are the results from QUERY_TIMEOUT=0, amf_sleep(1), 1ms timer
> period:
> > Encoder: AMFVideoEncoderVCE_AVC
> > Total : Frames = 500 Duration = 1157.16ms FPS = 432.09frames
> > Latency: First,Min,Max = 7.12ms, 1.53ms, 3.73ms
> > Latency: Average = 1.99ms
> >
> > and the results from QUERY_TIMEOUT=50, default timer period:
> > Encoder: AMFVideoEncoderVCE_AVC
> > Total : Frames = 500 Duration = 933.03ms FPS = 535.89frames
> > Latency: First,Min,Max = 5.80ms, 1.49ms, 2.50ms
> > Latency: Average = 1.58ms
> >
> > This seems to clearly demonstrate that QUERY_TIMEOUT is a better approach
> > than adjusting timer resolution. It avoids process-wide effects *and*
> > it even performs better on top of that.
> >
> >
> > Cameron
>
Thanks everyone and Cameron,
TIMEOUT might be a possible solution.
Need some time for evaluating the performance impact of using it.
The problem is that FFmpeg calls SubmitInput and QueryOutput
from the same thread and if B-frames and/or look-ahead enabled, initially
not enough input submitted and QueryOutput will wait till timeout value.
More information about the ffmpeg-devel
mailing list