Answers.Body: <p>2-pass is for video encoding when using an average bitrate target. When saving to MP4, default encoder is x264 whose default encoding mode is CRF where 2-pass is not applicable. The pass system also no connection with the use of filters, which is what scale and pad are.</p>
  
  <p>In any case, you can carry out scaling and padding in one command.</p>
  
  <pre><code>for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf "scale=1216:684,pad=1280:720:32:0" -preset faster "output\%%~na.mp4"
  )
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-20T16:30:45.483Z
Answers.Text: Thank you Gyan. That is exactly what I needed.
Answers.UserDisplayName: JHandin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-18T06:03:57.933Z
Answers.LastActivityDate: 2020-04-18T06:03:57.933Z
Answers.UserDisplayName: Gyan
Body: <p>I am trying to create a batch file with 2 passes. Pass 1 scales the video. Pass 2 pads a border around it. They both work separately but will not work together.</p>
  
  <p>Pass 1:</p>
  
  <pre><code>@echo off
  REM Scale video to 1216x684
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf scale=1216:684 -preset faster "output\%%~na.mp4"
  )
  pause
  </code></pre>
  
  <p>Pass 2:</p>
  
  <pre><code>@echo off
  REM Pad video to 1280x720
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf pad="1280:720:32:0" -preset faster "output\%%~na.mp4"
  )
  pause
  </code></pre>
  
  <p>Combined:</p>
  
  <pre><code>@echo off
  REM Scale video to 1216x684 and pad to 1280x720
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf scale=1216:684 -preset faster -pass 1 -f mp4 NUL &amp;&amp; \
  ffmpeg -i "%%a" -vf pad="1280:720:32:0" -preset faster -pass 2 "output\%%~na.mp4
  )
  pause
  </code></pre>
  
  <p>Error:</p>
  
  <p>CRF/CQP is incompatible with 2pass.
  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
  Conversion failed!</p>
  
  <p>What am I missing?</p>
  
Tags: <ffmpeg><scale>
Title: FFmpeg Batch encoding error: CRF/CQP is incompatible with 2pass
UserDisplayName: JHandin
ThreadText: # FFmpeg Batch encoding error: CRF/CQP is incompatible with 2pass
  
  (Asked by: username_0 on 2020-04-17)
  
  I am trying to create a batch file with 2 passes. Pass 1 scales the video. Pass 2 pads a border around it. They both work separately but will not work together.
  
  Pass 1:
  
  ```
  @echo off
  REM Scale video to 1216x684
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf scale=1216:684 -preset faster "output\%%~na.mp4"
  )
  pause
  
  ```
  
  Pass 2:
  
  ```
  @echo off
  REM Pad video to 1280x720
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf pad="1280:720:32:0" -preset faster "output\%%~na.mp4"
  )
  pause
  
  ```
  
  Combined:
  
  ```
  @echo off
  REM Scale video to 1216x684 and pad to 1280x720
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf scale=1216:684 -preset faster -pass 1 -f mp4 NUL && \
  ffmpeg -i "%%a" -vf pad="1280:720:32:0" -preset faster -pass 2 "output\%%~na.mp4
  )
  pause
  
  ```
  
  Error:
  
  CRF/CQP is incompatible with 2pass.
  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit\_rate, rate, width or height
  Conversion failed!
  
  What am I missing?
  
  **Tags:** ffmpeg, scale
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-18. Score: 0
  
  2-pass is for video encoding when using an average bitrate target. When saving to MP4, default encoder is x264 whose default encoding mode is CRF where 2-pass is not applicable. The pass system also no connection with the use of filters, which is what scale and pad are.
  
  In any case, you can carry out scaling and padding in one command.
  
  ```
  for %%a in (*.mp4) do ( ffmpeg -i "%%a" -vf "scale=1216:684,pad=1280:720:32:0" -preset faster "output\%%~na.mp4"
  )
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you username_1. That is exactly what I needed.  
  
  ---
  
  