[Libav-user] FFMPEG decoding H264 and Multithreading

Camera Man i.like.privacy.too at gmail.com
Sat Feb 9 19:32:48 CET 2013

On 02/08/2013 07:19 PM, Carl Eugen Hoyos wrote:

> You should use multi-threading if you want
> to decrease overall decoding time, if you
> need minimal cpu usage, force -threads 1
> (multithreading always has an overhead).

Additionally, multithreading introduces a decoding delay of (number of 
threads) frames - e.g., if you use 4 threads, the earliest time you'll 
get your frame out is when you feed in the 5th. If you're decoding from 
a file, that makes no difference - however, if you're showing a live 
stream at (say) 15 fps, then a 4 frame delay = ~300ms which is very 
noticeable - in this case you would also want to disable threads.

More information about the Libav-user mailing list