Jérôme SALAYET
2013-02-08 17:49:46 UTC
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 : ***@hymatom.fr <mailto:***@hymatom.fr>
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 : ***@hymatom.fr <mailto:***@hymatom.fr>