[Libav-user] Decoding multiple streams in parallel

Mercier, T.J. mercthom at lab126.com
Sun Mar 3 23:36:56 EET 2019


I have program (single process) that decodes multiple independent H.264 streams in parallel, each in a separate thread. Each thread creates its own AVCodec, AVFrame, AVCodecParserContext, AVCodecContext, and AVPacket (pointers to) objects. Nothing is shared between threads and I do not do any of my own synchronization around the decoding. My expectation was that each thread would use as much CPU as was necessary, and that I could scale up the number of parallel decoding threads to saturate the number of hardware threads on my machine (36). However no mater how many decoding threads I create, the process uses at most 1 CPU core instead of the 36 that are available. Each of the decoding threads uses roughly 1/(N threads) of that single core.

What's going on here, and how do I get libavcodec to use more of the available CPU?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190303/42f1dd4a/attachment.html>

More information about the Libav-user mailing list