[MPlayer-dev-eng] dav1d threading

Alexander Strasser eclipse7 at gmx.net
Mon Jan 13 23:47:56 EET 2020

Hi Sylvain!

On 2020-01-13 02:18 +0000, sylvain.bertrand at gmail.com wrote:
> I cannot decode in realtime av1 videos from youtube. After a bit of digging:
> dav1d is configured with only 1 thread for tiles decoding and only 1 thread for
> frames decoding.
> Is this a ffmpeg or mplayer configuration issue?

It's not an FFmpeg problem, it is a, for today probably bad, default
choice of MPlayer.

Using e.g "-lavdopts threads=8" should help. Here is the excerpt from
the man page:

                 threads=<1-8> (MPEG-1/2 and H.264 only)
		                       number of threads to use for
				       decoding (default: 1)

Reading it now again I see several errors, it's not MPEG-1/2 and H.264
only and it probably doesn't make sense to document it at that level
of detail. The range is also off, because we have increased the limit
up to 16 in year 2012 and up to 32 in year 2016 (see ticket #2289).

I will change this immediately because I think keeping known wrong
documentation is possibly harmful.

Now to the default value of 1. I think it's rather bad for the
multi-core-on-all-devices-world we live in today. The default dates
back to the introduction of multi thread to MPlayer vd_ffmpeg in
late 2005. The beginning of multi-threaded decoding in FFmpeg were
in early 2004 if I'm not mistaken.

I will think of better default if no one beats me to it. AFAIK it
should be possible to get libavcodec to choose a thread limit that
fits the number of logical cores on systems where it can query the
information. If there no obvious downsides to that, I think that
would be probably a good way to go forward.


More information about the MPlayer-dev-eng mailing list