[FFmpeg-user] Question about 2 pass encoding

Srikanth Kotagiri srikanthk at gmail.com
Mon Apr 1 17:30:45 EEST 2024


On Mon, Apr 1, 2024 at 3:40 AM Aditya Dandavate
<adityadandavate04 at gmail.com> wrote:
>
> and then
>
> ffmpeg -y -i Capture.mp4 -pix_fmt yuv420p -c:v libx264 -pass 1 -an
> -b:v 2600k -f mp4 NUL
>
> ffmpeg -y -i Capture.mp4 -pix_fmt yuv420p -c:v libx264 -pass 2 -an
> -b:v 2600k myVideo.mp4
>
>
> Source :
>
>  https://video.stackexchange.com/questions/21953/ffmpeg-error-2nd-pass-has-more-frames-than-1st-pass
>
>
> Can I use `-c:a` copy for audio codec instead of `-an` for both passes ?
> _______________________________________________
> ffmpeg-user mailing list

When you run the first pass command, you are creating a "stats file".
Notice the -f mp4 NUL, there is no actual media output being created.
Adding -c:a copy or any actual codec is a waste of IO. You can include
-c:a copy in the second pass where you are actually creating an output
file.


More information about the ffmpeg-user mailing list