Thanks a lot for the tutorial link and suggestion.
I tried your suggestion of adding AVDictionary and it worked very well. I
got good performance improvement, basically from 39 sec to 14 secs for the
same video clip so pretty impressive !
Also, found the problem with my code was that the line
"*codec_context->thread_count
= 2;*" had to be called before opening the codec "*avcodec_open2()*", so
when I move it up it works too. Thats how they have done it in OpenCV code
as well. But I find your way much better as it automatically decides the
threads based on the machine.

Cheers

On Thu, Jul 21, 2016 at 4:47 AM, Gonzalo <[email protected]> wrote:

>
>
> El 20/07/16 a las 18:58, Puneet Kapoor escribió:
>
>>
>> If you could share some examples of multi-threaded libav user code, it
>> would be helpful.
>>
>> Thanks
>>
>> Google for "dranger ffmpeg".  The original page is a tutorial page, but
> it is a tad out of date.  Some other repositories contain updated code.
>
> Some demuxers may support multithreaded operation, albeit for most
> operations you gain little.  For that, you can use:
>
>   AVDictionary* info = NULL;
>   av_dict_set(&info, "threads", "auto", 0);
>
>   avcodec_open2( video_ctx, video_codec, &info );
>
>
> --
> Gonzalo GarramuƱo
> [email protected]
>
> _______________________________________________
> Libav-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/libav-user
>
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to