VP9 Two-Pass Encoding: How to Run the First Pass

Performing a two-pass encode with the libvpx-vp9 codec in FFmpeg is the industry standard for achieving the best balance between video quality and target file size. This guide explains how to execute the initial first pass of this process, detailing the specific command-line arguments required to analyze your source video and generate the necessary log file for the second pass.

To run the first pass of a two-pass VP9 encode, you must use FFmpeg to analyze the video and write the analysis statistics to a log file. Because the actual video output of the first pass is not needed, you discard the output video stream to save time and disk space.

The First Pass Command

Run the following command in your terminal:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -pass 1 -an -f null /dev/null

Note: If you are using Windows, replace /dev/null at the end of the command with NUL.

Parameter Breakdown

Once this command finishes, you will see a newly created log file in your directory. You are then ready to execute the second pass, which will read this log file to apply the final compression and encode the audio.