2024-10-24, 08:20 PM
(2024-10-24, 03:07 PM)TheDreadPirate Wrote: Encoding is definitely parallel, but the rate of return as you add more threads is not linear above ~8 threads. At least with x264. I haven't tried with x265, but that is out of the question anyway with this old of a CPU.x264 is probably the best developed encoder there is.
So many innovative concept and many rounds of speed optimizations went into it.
According to this diminishing returns sets in past 64 cores.
https://imgur.com/a/5Q9JpJp
And this is on ffmpeg 4.0 I can't imagine it getting worse in last years.
Unfortunately i couldn't find a similar well done Benchmark for x264 but since x265 borrowed a lot from x264 they should scale similar.
This was done on an Intel® Xeon® CPU E7-8890 v3 @ 2.50GHz
https://singhkays.com/blog/x265-128-core...-azure-vm/
I read somewhere x264 nearly scaled perfectly linear until you reach 40 vertical px per thread.
So assuming a 1080p video scaling would diminish after 27 threads. (for 2160p or 4k it would be 54 threads)
Also OP asked about direct playing a 4k file and encoding a 1080p h264 at the same time.
Lets assume worst case we need:
2x 4k decode->encode 1080p+ overhead (audio+ whatever)
We don't need to scale to 12cores; we have 12 cores for 2 parallel encodes for x264 on the fastest preset. Easy.
And there is always the ultimate cheatcode: "mitigations=off" for another 25% more speed