Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I see that there's a -threads <count> command line option in ffmpeg. What is the default value of this option?

share|improve this question
up vote 9 down vote accepted

it depends on codec used and your CPU core count. For example libx264 for encoding into H.264 use 1 thread per CPU core.

share|improve this answer
Thanks. Do you have a reference to the defaults for some standard codecs supported by ffmpeg? – Jun 22 '10 at 9:26
Don't rely on it. My ffmpeg 0.7.8 on Linux uses 1 thread by default no matter what. – Barafu Albino Dec 22 '11 at 19:30
This is incorrect. With libx264 it is cores x 1.5 for frame threads and cores x 1 for slice threads. – LordNeckbeard Apr 3 '15 at 18:23

As of 2014, it uses an optimal number.

You can verify this on a multi-core computer by examining CPU load (Linux: top, Windows: task manager) with different options to ffmpeg:

  • -threads 0 (optimal);

  • -threads 1 (single-threaded);

  • -threads 2 (2 threads for e.g. an Intel Core 2 Duo);

  • none (the default, also optimal).

2015 edit: on a 12-core CPU, some ffmpeg commands have Linux top showing at most 200% cpu (only 2 cores), no matter what number is given to -threads. So the default may still be optimal in the sense of "as good as this ffmpeg binary can get", but not optimal in the sense of "fully exploiting my leet CPU."

share|improve this answer

assuming you have threading enabled, it assigned 1.5x number of cores.

share|improve this answer
1.5 x number of cores for frame threads. 1 x number of cores for slice threads. This is specific for (lib)x264. I'm not sure what the allocation is for other encoders. – LordNeckbeard Apr 3 '15 at 18:21
@LordNeckbeard How to switch between frame threading and slice threading!? – Mr.Hyde Aug 16 '15 at 5:50
@Mr.Hyde Probably with -x264-params sliced-threads=1. Or via usage of -tune zerolatency. – LordNeckbeard Aug 17 '15 at 19:55

In 2015 on Ubuntu 14.04 with ffmpeg 0.8.10-6, it used 1 core on a 4 core system. htop showed this; only one core was used, and I got 16 fps conversion rate for a FullHD video.

Using -threads 4 made all my CPU cores go to 100% and I got a conversion rate of 47 fps.

I used the following command:

$ ffmpeg -i foo.mp4 -y -target pal-dvd -aspect 16:9 dvd-out.mpg
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .