Ubuntu - Video - Change ffmpeg -threads settings

The option flag you want is really just -threads and you would use it like this (for just one thread):

ffmpeg -i somefile.wmv -c:a libfdk_aac -c:v libx264  -threads 1 transcoded.mp4

However, there are quite a few subtleties that will raise your server load and ops time, such as rescaling, applying filters and final frame quality / frame rate - not to mention the fact that some VM architectures actually read and write everything twice (once natively and once virtually!!!)

Here are a few tips to get your speed up:


Use docker

There is already a predefined ffmpeg image on github: https://github.com/jrottenberg/ffmpeg.

A single conversion will likely run slower because of the overhead but if you run multiple instances concurrently this could be a huge benefit.

Any this will scale very well, not to mention the improved security because each task is isolated from the underlying OS.

docker run jrottenberg/ffmpeg \
        -i http://url/to/media.mp4 \
        -stats \
        $ffmpeg_options  - > out.mp4