./ffmpeg -i 'in.flv' -c:v libx264 -profile:v main -b:v 300k -preset veryslow -c:a aac -b:a 100k -bufsize 20m -pix_fmt yuv420p -t 60 -pass 1 -f mp4 NUL
./ffmpeg -i 'in.flv' -c:v libx264 -profile:v main -b:v 300k -preset veryslow -c:a aac -b:a 100k -bufsize 20m -pix_fmt yuv420p -t 60 -pass 2 test.mp4

https://gist.github.com/hsab/7c9219c4d57e13a42e06bf1cab90cd44

2 Pass example:

  • Download FFMPEG fro Windows
  • Extract and go to “bin” folder.
  • In “bin” hold Shift+RightClick and select Open PowerShell…
  • For pass 1: .\ffmpeg.exe -thread_queue_size 512 -y -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -b:v 2410k -c:a aac -strict experimental -b:a 320k -pass 1 -f mp4 NULL
  • For pass 2: .\ffmpeg.exe -thread_queue_size 512 -r 24 "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -b:v 2410k -c:a aac -strict experimental -b:a 320k -pass 2 "D:\output.mp4"

CRF example:

  • Lossy CRF (1-51): .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -crf 2 -c:a aac -strict experimental -b:a 320k "D:\crf2_output.mp4"
  • Lossless CRF 0 H264: .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv444p -vprofile high444 -vlevel 5.1 -preset veryslow -crf 0 -c:a aac -strict experimental -b:a 320k "D:\crf0_output.mp4"
  • Lossless CRF 0 H265: .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx265 -preset veryslow -crf 0 -c:a aac -strict experimental -b:a 320k "D:\crf0_output.mp4"

Parameters Explained:

Framerate of Source: -r 24

Source Video: -i "D:\%04d.png" (Image Sequence eg 0001.png)

Source Audio: -i "D:\Max.wav"

Codec Video: -c:v libx264

Pixel Format: -pix_fmt yuv420p

H264 Profile: -vprofile high422

H264 Level: -vlevel 4.2

Compression (Loseless): -preset veryslow

Bitrate Video: -b:v 2410k (Calculated as above)

Pass Number: -pass 1

Codec Audio: -c:a aac

Needed For AAC: -strict experimental

Bitrate Audio: -b:a 320k (Desired audio rate)

Format: -f mp4