Reputation: 11
I want to know that how can I implement fast encoding with ffmpeg. I used this code:
vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1000k -shortest -acodec libmp3lame -b:a 128k -ar 44100 -threads 0 -preset veryfast
But it only uses 50% CPU(dual xeon 2.3 ghz) and 2% (15gb) Ram.
Now I want it to use a lot of cpu and ram for fast encoding, how to do? Thanks everyone
Upvotes: 1
Views: 4869
Reputation: 2518
How many threads are being used, highly depends on used codec, settings and hardware. Besides that, RAM is used rarely that amount by "just" 1000k bitrate with a small resolution. So you might never need about 15G of RAM.
In your case, you're setting -threads 0
which means "optimal usage" of hardware (will be set automatically by some algorithms). I do not recommend it, but you can try setting -threads 2
for 2 threads, or -threads 4
for 4 threads.
As a rule of thumb, you can set one thread per core (if you have 4 cores, use 4 threads, 8 cores - 8 threads, and so on).
Please be aware, that simultaneously encoding video at all cores and audio might result in lower speed, than another "optimal usage" calculated by ffmpeg itself. Just give it a try ;-)
Upvotes: 2