[Libav-user] FFMPEG decoding H264 and Multithreading
Jérôme SALAYET
jerome.salayet at hymatom.fr
Fri Feb 8 18:49:46 CET 2013
Hello, I'm using FFMPEG to decode video streaming from an IP Camera. all seems good but I try to decrease the CPU usage of my application when I decompress several differents streams.
In fact, I have a dual core processor, and if I decode one stream, my CPU usage is very low (so good). If I decompress two streams, it's ok too. But if I had a third decompression, my CPU increase from 2-5% to 25-30%.
So, I try to activate Mutlithreading in FFMPEG (compiling with --enable-w32threads) with Mingw.
But if I initialize my AVCodecContext with thread_count=3 (because I have a dual core processor) and thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE, when I use avcodec_open2, I always got an result error -22: The maximum value for lowres supported by the decoder is 0. I read where this message appear in FFMPEG code source and it's in utils.c
if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0)
But in my code before call avcodec_open2( lpCodecCtx, lpCodec, ...) I have m_lpCodec->max_lowres=0 and m_lpCodecCtx->lowres=0, so I don't understa,nd why I always have this error.
After add some traces in Utils.c, it seems I have avctx->codec->max_lowres=0 and avctx->lowres=3 but I don't understand why...
Perhaps, trying Multithreading isn"t the good solution to decrease the CPU usage, I'm not very sure of this point.
Thanks for your answers,
Jérôme SALAYET
Ingénieur Informatique
Tél : 04 67 87 61 12
Fax : 04 67 70 85 44
Site web : www.hymatom.fr <http://www.hymatom.fr/>
Email : jerome.salayet at hymatom.fr <mailto:jerome.salayet at hymatom.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130208/8bea932b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 7598 bytes
Desc: image001.png
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130208/8bea932b/attachment.png>
More information about the Libav-user
mailing list