[Libav-user] Multithread decode and scaler

wolverin wolverin82 at mail.ru
Mon Aug 22 07:27:33 EEST 2022


>libavfilter is a little harder to set up (but not that much if you have only one input and one output), but it can take care of more issues at
>once.
 
I set the threads like this
 
        if ((rt = avfilter_graph_create_filter(&pFltCtxBufSink, pFltBufSink, "out", NULL, NULL, pFltGph)) < 0)
        {
            PrintError("Error create buffer sink", rt);
            return rt;
        }
        pFltCtxBufSink->nb_threads = 10;
        pFltCtxBufSink->graph->nb_threads = pFltCtxBufSink->nb_threads;
 
Now I see swscaler warnings 40 times, why? ffmpeg gives out only 20
 
       [swscaler @ 0x1a2aa00] [swscaler @ 0x1bf6ab0] deprecated pixel format used, make sure you did set range correctly
 
Scaling has accelerated by about 3 times, but it's still slow (about 50 ms, it was 130)
  
>I do not know if it supports it. Try setting the threads options on it
>too.
 
Probably the mjpeg decoder does not support threads.
Don't work
 
    av_dict_set(&pDicInp, "threads", "10", 0);
    AVDictionary * opts = NULL;
    av_dict_copy(&opts, pDicInp, 0);
    rt = avformat_open_input(&pFmtCtxInp, device, pInpFmt, &opts);
 
OR
 
    if (!(pCdcCtxInp = avcodec_alloc_context3(pCdcInp)))
    {
        PrintError("Error allocate decoder context", (rt = AVERROR(ENOMEM)));
        return rt;
    }
    pCdcCtxInp->thread_count = 10;
  
>Also try to use the command-line tool to see if multithreading is indeed
>used.
 
Please explain what it is about?
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220822/e48440a6/attachment.htm>


More information about the Libav-user mailing list