Install schedtool (its in package repostiories), and then to encode, run
'schedtool -D -e <rest of encode command>'.
-D means run at idle priority, -e means execute given command.
Take a look at various encoding scripts posted in forums and wiki, since small filesize at high quality is important here.
Also, CRF value is the most important for filesize-quality tradeoff. 20 is the usual high-quality value (sometimes bit larger numbers like 23 are used). Higher values result worse quality but smaller files.
Then there are parameters that control CPU-time vs. filesize tradeoff. Increasing the CPU time used usually results smaller files (but one pretty quickly runs into decreasing returns).
With something similar to --deldup from Direct264, you can save a lot on most movie... but nobody seem to get this feature working under a linux system, without using wine or stuff like that.
According to nice(1) manpage I have, 19 is the lowest of normal priorities and -20 is the highest of normal priorities. And indeed, trying to give nice of +20 to process results nice +19 process (Linux).
Below normal priorities is idle priority, and above normal priorities are realtime priorities.