title: ffmpeg quality conversion options (video compression)
body: <p><strong>Can you provide a link, or an explanation, to the <code>-q:v 1</code> argument that deals with video/image quality, and compression, in ffmpeg.</strong></p>
  <p>Let me explain...</p>
  <pre><code>for f in *
     do 
       extension=&quot;${f##*.}&quot;
       filename=&quot;${f%.*}&quot;
       ffmpeg -i &quot;$f&quot; -q:v 1 &quot;$filename&quot;_lq.&quot;$extension&quot;
       rm -f &quot;$f&quot;
     done
  </code></pre>
  <p>The ffmpeg <code>for</code> loop above compresses all images and videos in your working directory, it basically lowers the quality which results in smaller file sizes (the desired outcome).</p>
  <p>I'm most interested in the <code>-q:v 1</code> argument of this <code>for</code> loop. The <code>1</code> in the <code>-q:v 1</code> argument is what controls the amount of compression. But I can't find any documentation describing how to change this value of <code>1</code>, and describing what it does. Is it a percentage? Multiplier? How do I adjust this knob? Can/should I use negative values? Integers only? Min/max values? etc.</p>
  <p>I started with <a href="https://ffmpeg.org/ffmpeg.html#Video-Options" rel="nofollow noreferrer">the official documentation</a> but the best I could find was a section on video quality, and the <code>-q</code> flag description is sparse.</p>
  <blockquote>
  <p>-frames[:stream_specifier] framecount (output,per-stream)<br />
  Stop writing to the stream after framecount frames.<br />
  .<br />
  -q[:stream_specifier] q (output,per-stream)<br />
  <br />
  -qscale[:stream_specifier] q (output,per-stream)<br />
  Use fixed quality scale (VBR). The meaning of q/qscale is codec-dependent. If qscale is used without a stream_specifier then it applies only to the video stream, this is to maintain compatibility with previous behavior and as specifying the same codec specific value to 2 different codecs that is audio and video generally is not what is intended when no stream_specifier is used.</p>
  </blockquote>