title: opencv - videowriter control bitrate
body: <p>I have a working python script that uses the video writer from opencv. </p>
  
  <p>source <a href="https://gist.github.com/stanchiang/b4e4890160a054a9c1d65f9152172600" rel="noreferrer">https://gist.github.com/stanchiang/b4e4890160a054a9c1d65f9152172600</a></p>
  
  <hr>
  
  <p>If i take in a file, and regardless of whether I simply pass the video frame through to the writer (effectively duplicating the file) or if i try to edit the frame, the file is always larger. I would like for it to be no larger than the original (since if you read my script i'm blurring a lot of stuff).</p>
  
  <p>After checking their metadata, with <code>ffprobe -v quiet -print_format json -show_format -show_streams inputFile.mp4</code> I notice that the bitrate of the new file is over 5.5x higher than before.</p>
  
  <p>source <a href="https://www.diffchecker.com/8r2syeln" rel="noreferrer">https://www.diffchecker.com/8r2syeln</a></p>
  
  <hr>
  
  <p>since bitrate is a big determinant of file size, I'm wondering if</p>
  
  <ol>
  <li>i can hardcode the desired bitrate of the new file through the video writer</li>
  <li>whether for some reason the heavily increased bit rate is needed</li>
  </ol>