[FFmpeg-user] 2nd pass has more frames than 1st pass (99021)2kbits/s dup=27 drop=0 speed=4.76x

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Nov 30 09:56:52 EET 2020


Carl Eugen,

Thanks for taking the time to answer my questions.

On Sun, Nov 29, 2020 at 7:40 PM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>
> Am So., 29. Nov. 2020 um 16:32 Uhr schrieb Mathieu Malaterre
> <mathieu.malaterre at gmail.com>:
>
> > $ ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 1 -an -f null
> > /dev/null && \
> > ffmpeg -y -i input.avi -c:v libx264 -b:v 1321894 -pass 2 -c:a aac -b:a
> > 128k fixed.mp4
>
> This cannot work (and this is not related to the fact that you are not
> using a version of FFmpeg that we support here).
>
> In some cases - if you are lucky - there is a crash and no output file
> is written, in other cases, a "broken" output file is written, broken in
> the sense that two-pass encoding did not work the way it is supposed
> to (more bitrate was given to frames that do not need it).
>
> Do not use -an on the first pass and add "-vsync cfr" to the first pass.
> (Other workarounds are possible.)

Confirmed. The above suggestion does fix the symptoms.

Did you base your suggestion on:

"Error while decoding stream #0:1: Invalid data found when processing input" ?

> For future questions: Do not cut FFmpeg's console output, only
> post ffprobe output if you see an issue with it.
>
> Not really related:
> > Does it make sense to simply copy/paste the existing bit_rate to
> > re-encode it ?
>
> No, to the best of my knowledge, it makes no sense whatsoever.
>
> Very generally you either want a specific output quality, in this
> case specifying a bitrate and two-pass encoding make no
> sense.
> Or you have a particular size requirement for the output file,
> then bitrate and two-pass encoding make sense.

Are you saying that taking the original file size as size requirement
is the whole issue ?
If I follow the guide again and do the computation as described, the
bitrate value is just very slightly different:

>>> 690*8192./(3600+6*60+2) - 128
1298.673397274104

Assuming my mp3 audio did not have any particular problem, would there
be an actual difference in between using -b:v 1298k vs -b:v 1321894 ?


Thanks again,

> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



--
Mathieu


More information about the ffmpeg-user mailing list