title: what FFMPEG performance settings to use for processing videos for the web
body: <p>I have a few questions regarding usage of ffmpeg for processing videos for the web. I'm a beginner so please bear with me (although I read some docs on the internet)</p>
  
  <h3>Performance</h3>
  
  <ul>
  <li>First of all, given the fact that FFMPEG utilizes all cores at 100%, what is the actual parallelism efficiency? </li>
  </ul>
  
  <p>Let's assume the following scenario. I have a video (fullHD, doesn't matter what encoders / compression format was used to obtain the video) and I want to resize (downscale) to various sizes (e.g. 240px, 480px and 720px height) using mp4 format (thus using libx264 with aac codecs).</p>
  
  <p>Using ffmpeg, I see that all of my laptop's cores (8) are used at 100% and I was wondering what scenarios can improve the overall performance of the whole processing task. So this leads us to basically 2 scenarios: Assuming the video mentioned above as input, for obtaining the 3 output videos (@ 240px, 480px and 720px height sizes), we:</p>
  
  <ol>
  <li>Process input video and obtain 1 output video at a time, and let all the cores work at the same time at 100%;</li>
  <li>Process the video to obtain all output videos in parallel, by bounding each output video to a single processor core which'll work at 100%;</li>
  </ol>
  
  <p>So the question is actually reduced to the parallelism efficiency of the ffmpeg program. </p>
  
  <p>This means that letting ffmpeg process the task <code>procVideo</code> - <em>which takes 1 input video to produce 1 single output video (transcoding/downscaling and so on)</em> - on N processor cores doesn't mean it finish the task N times faster than letting it run the same task bound to a single core. So if the efficiency is smaller than 100%, it's better to have N <code>procVideo</code> tasks in parallel, each bound to a single core, rather than doing the task sequentially for each output video.</p>
  
  <hr>
  
  <h3>Codecs</h3>
  
  <p>Other than the above performance problem, the usage of codecs bugs me. I am trying to obtain mp4 videos because of the wide implementation of the format in html5 browsers.</p>
  
  <p>So having a video as input in any format, I want to convert it to mp4. So I'm using libx264 codec with aac.</p>
  
  <ul>
  <li>Use libx264, x264 or h264 for video encoding/decoding?</li>
  <li>Use libfdk_aac, libaacplus or aac for audio encoding/decoding to aac?</li>
  </ul>
  
  <p>Also, I would like to know what are the licesing fees for each of the above codec, as the online resources on these are quite limited / hard to understand.</p>
  
  <p>If anyone could shed some light on those questions, I would really be grateful! Thanks for your time!</p>