title: node-fluent-ffmpeg doesn't resize videos correctly when given specific size
body: <h3>Version information</h3>
  
  <ul>
  <li>fluent-ffmpeg version: 2.1.2</li>
  <li>ffmpeg version: ffmpeg version 4.1.3</li>
  <li>OS: mac os x mojave 10.14.3</li>
  </ul>
  
  <h3>Code to reproduce</h3>
  
  <p>First cut the videos using this command:</p>
  
  <pre class="lang-js prettyprint-override"><code>const cutVideo = async (currentWord) =&gt; {
      return new Promise((resolve, reject) =&gt; {
          console.log('cutting video', currentWord.file)
          ffmpeg(currentWord.file)
              .videoCodec('libx264')
              // .addOptions('-vf "setdar=ratio=16/9:max=1000"')
              .on('start', command =&gt; console.log('command', command))
              .on('error', reject)
              .on('end', resolve)
              .withSize('640x360')
              .withAspect('16:9')
              .applyAutopadding(true, 'black')
              .saveToFile(currentWord.file.replace('-unfinished', ''), './')
      })
  }
  </code></pre>
  
  <p>Later merge them together using <code>.mergeToFile()</code> command:</p>
  
  <pre class="lang-js prettyprint-override"><code>const mergeFilesAsync = async function(files, folder, filename)
  {
      return new Promise((resolve, reject) =&gt; {
          console.log('merging files', files)
          var cmd = ffmpeg({ logger: console })
              .videoCodec('libx264')
              .on('start', command =&gt; console.log('command', command))
              .on('error', reject)
              .on('end', resolve)
  
          for (var i = 0; i &lt; files.length; i++)
          {
              const currentWord = files[i]
              cmd.input(currentWord.file.replace('-unfinished', ''))
          }
  
          cmd.mergeToFile(folder + "/" + filename, folder);
      });
  }
  </code></pre>
  
  <h3>Expected results</h3>
  
  <p>The videos resized in cutVideo function should have 640x360 size with 16:9 aspect ratio.</p>
  
  <h3>Observed results</h3>
  
  <p>The first video processed had a dimension of: 850 × 480, the output after processing it is: 642 × 360 (It should be 640x360)</p>
  
  <p>The second video processed had a dimension of: 1152 × 480, the output after processing it is: 638 × 360</p>
  
  <p>The third video processed had a dimension of 853 × 480, the output after processing it is: 642 × 360</p>
  
  <h2>FFmpeg command produced by fluent-ffmpeg:</h2>
  
  <pre class="lang-sh prettyprint-override"><code>ffmpeg -i /Users/yagiz/Desktop/video-creator/what's-unfinished.mp4 -y -vcodec libx264 -filter:v scale=w='if(gt(a,1.7777777777777777),640,trunc(360*a/2)*2)':h='if(lt(a,1.7777777777777777),360,trunc(640/a/2)*2)',pad=w=640:h=360:x='if(gt(a,1.7777777777777777),0,(640-iw)/2)':y='if(lt(a,1.7777777777777777),0,(360-ih)/2)':color=black /Users/yagiz/Desktop/video-creator/what's.mp4
  cutting video /Users/yagiz/Desktop/video-creator/up?-unfinished.mp4
  </code></pre>
  
  <p>and</p>
  
  <pre class="lang-sh prettyprint-override"><code>ffmpeg -i /Users/yagiz/Desktop/video-creator/up?-unfinished.mp4 -y -vcodec libx264 -filter:v scale=w='if(gt(a,1.7777777777777777),640,trunc(360*a/2)*2)':h='if(lt(a,1.7777777777777777),360,trunc(640/a/2)*2)',pad=w=640:h=360:x='if(gt(a,1.7777777777777777),0,(640-iw)/2)':y='if(lt(a,1.7777777777777777),0,(360-ih)/2)':color=black /Users/yagiz/Desktop/video-creator/up?.mp4
  </code></pre>
  
  <p>I think that 1.77777 value in this command produces a lower bound or an upper bound of the actual item. </p>
  
  <p>Any idea where the issue lies?</p>
  
  <p>Thanks!</p>