[Libav-user] multithreading video decoding support using ffmpeg

Евгений Гарифуллин grisme at yandex.ru
Fri Jan 3 08:41:08 CET 2014


about 1)
i think, you must to set thread_type values. when you call avcodec_open(),  it calls validate_thread_parameters(). validate_thread_parameters corrects AVCodecContext::active_thread_type member via AVCodecContext::thread_count and AVCodecContext::thread_type values.

about 2)
ffmpeg library must handles that. :) again: after you call avcodec_open(): avcodec_open() calls ffmpeg_thread_init() and frame_thread_init(). 
you must check it. this is not accurate information from me.

03.01.2014, 13:22, "Ierum Shanaya" <ierumshanaya85 at gmail.com>:
> Thanks for the quick response!!
>
> 2 queries:
>
> 1) Do we have to also set the thread_type ( thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE) ? or Just by setting the thread count (AVCodecContext::thread_count) before avcodec_open() works?
>
> 2) Do we have to do the thread synchorinization also? or ffmpeg library handles that.. Because I had read in some links/discussions, that the functions avcodec_open() and avcodec_close() are not thread safe?
>
> Thanks,
> Ierum
>
> On Fri, Jan 3, 2014 at 12:35 PM, Евгений Гарифуллин <grisme at yandex.ru> wrote:
>> 03.01.2014, 00:38, "Ierum Shanaya" <ierumshanaya85 at gmail.com>:
>>> hi,
>>>
>>> I tried looking into the documentation of how to use multithreading to decode a h264 or mpg video static file, but could not find any detailed note.
>>>
>>> Could you please help me understand - how can we use multithreading to decode an incoming static video stream.
>>>
>>> If you can share me some sample programs , it would be of great help.
>>>
>>> Thanks,
>>> Ierum
>>
>> threads for multithreading decoding (AVCodecContext::thread_count) must be set _before_ call to avcodec_open().
>>
>> --
>> С уважением, Евгений Гарифуллин.
>> e-mail: grisme at yandex.ru
>> jabber: joffadark at jabber.ufanet.ru
>> ICQ : 387906261
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>
> ,
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user


-- 
С уважением, Евгений Гарифуллин.
e-mail: grisme at yandex.ru
jabber: joffadark at jabber.ufanet.ru
ICQ : 387906261


More information about the Libav-user mailing list