[Libav-user] Threading a h264 video decoder - timing is odd.
net at point.com.mk
Fri Jun 3 22:30:58 CEST 2016
On 03.06.2016 16:18, Nicolas George wrote:
> Le sextidi 16 prairial, an CCXXIV, Jesper Taxbøl a écrit :
>> I am working on a threaded video reader to spread the decode workload on
>> some more cores and gain some speed. My source is included below:
>> The thing is that I dont see a time improvement when starting two processes
>> instead of one. On a 80mb mp4 file it takes 6 seconds to decode the video,
>> while doing two in parallel takes 12 seconds. I can see that two cores's
>> are used 100 percent. Im on a fast SSD disk so I dont think im IO limited.
>> What could be the case. Is it the same decoder taht is doing all the work?
>> Do I perhaps need to instantiate a context or something?
> The decoders for the most common codecs, including the ones you are probably
> using in your MP4 files, are already threaded in FFmpeg. Unless you have a
> lot of cores, a single instance of the decode probably already uses them all
> completely. Running several instance in parallel will only add
> context-switching overhead.
Some commit from apr 10+ changed default decode using all cores, to a
single core (or fewer cores).
For my case: Using zeranoe 32 bit dll's on Win64 decoding video, mpeg2
pCodecCtx->thread_count=0; fixes the issue (auto)
It may be me, Zeranoe, or else; sorry i did not research that.
But pCodecCtx->thread_count=0; fixed that here; hope will help others.
More information about the Libav-user