title: Why sliced thread affect so much on realtime encoding using ffmpeg x264?
body: <p>I'm using ffmpeg libx264 to encode a 720p screen captured from x11 in realtime with a fps of 30.
  when I use <strong>-tune zerolatency</strong> paramenter, the average encode time per-frame can be as large as 12ms with profile baseline.</p>
  
  <p>After a study of the ffmpeg x264 source code, I found that the key parameter leading to such long encode time is <strong>sliced-threads</strong> which enabled by -tune zerolatency. After disabled using -x264-params sliced-threads=0 the encode time can be as low as 2ms</p>
  
  <p>And with sliced-threads disabled, the CPU usage will be 40%, while only 20% when enabled.</p>
  
  <p>Can someone explain the details about this sliced-thread? Especially in realtime encoding(assume no frame is buffered to be encoded. only encode when a frame is captured).</p>