[Libav-user] Fast parsing of H.264 video stream using libavcodec

Puneet Kapoor puneet.cse.iitd at gmail.com
Thu Jul 21 11:32:12 EEST 2016


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 <ggarra13 at gmail.com> 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
> ggarra13 at gmail.com
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160721/ca04c6ac/attachment.html>


More information about the Libav-user mailing list