<div dir="ltr">Thanks a lot for the tutorial link and suggestion.<div>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 !</div><div>Also, found the problem with my code was that the line "<b style="font-size:12.8px"><b>codec_context->thread_count = 2;</b></b>" had to be called before opening the codec "<b style="font-size:12.8px">avcodec_open2()</b>", 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.</div><div><br></div><div>Cheers</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 4:47 AM, Gonzalo <span dir="ltr"><<a href="mailto:ggarra13@gmail.com" target="_blank">ggarra13@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
El 20/07/16 a las 18:58, Puneet Kapoor escribió:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you could share some examples of multi-threaded libav user code, it would be helpful.<br>
<br>
Thanks<br>
<br>
</blockquote></span>
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.<br>
<br>
Some demuxers may support multithreaded operation, albeit for most operations you gain little.  For that, you can use:<br>
<br>
  AVDictionary* info = NULL;<br>
  av_dict_set(&info, "threads", "auto", 0);<br>
<br>
  avcodec_open2( video_ctx, video_codec, &info );<div class="HOEnZb"><div class="h5"><br>
<br>
-- <br>
Gonzalo Garramuño<br>
<a href="mailto:ggarra13@gmail.com" target="_blank">ggarra13@gmail.com</a><br>
<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</div></div></blockquote></div><br></div>