[MEncoder-users] two-pass encoding for creating DVD-video
Trent Piepho
xyzzy at speakeasy.org
Wed May 9 13:16:01 CEST 2007
On Wed, 9 May 2007, Nico Sabbi wrote:
> scostas wrote:
> >Hi all:
> >
> >I read in some web pages that mencoder doens't honor the vrc_maxrate
> >parameter when using two-pass enconding, so it's not recomendable to use
> >it to create MPEG-2 files for video DVDs, and use only single-pass
> >encoding for these cases. Is this true?
> >
> >
> >
> false. You had to specify the avg and maxrate + the vrc_buf_size
mencoder (via lavc) _did_ have a problem with honoring the vrc_maxrate
parameter. In both 1 pass and 2+ pass encoding. And I'm absolutely sure that
vbitrate, vrc_max_rate and vrc_buf_size were set correctly. No modification
of any bitrate related parameter would fix it.
Since 2-pass tends to produce greater bitrate spikes, this bug was much more
of a problem with 2-pass mode.
This patch appears to have fixed the problem:
r6565 | michael | 2006-10-05 12:27:18 -0700 (Thu, 05 Oct 2006) | 2 lines
Changed paths:
M /trunk/libavcodec/mpegvideo.c
M /trunk/libavcodec/mpegvideo.h
fix buffer underflows by reencoding the current frame with a higher QP
It doesn't look like this fix is integrated into the 2-pass rate control
system. My understanding of that patch, is that if a frame is encoded and the
resulting size of that frame breaks the maxrate (by overflowing the rc
buffer), that one frame is re-encoded at lower quality until it's small enough
to not overflow. It's much better to instead drop the quality of the frames
before by a little bit, rather than drop the quality of one frame by a lot.
That's sort of the whole point of 2-pass rate control.
Lots of people would claim this bug didn't exist for a number of reasons:
Exceeding the maxrate usually has no effect for playback on a computer. It's
only hardware DVD or SVCD players that care. Someone would encode to mpeg2
and the final file size would be correct and it would play back fine with
mplayer, so they assume there must be no problem. It's easy to jump to the
conclusion of user error.
The maxrate allowed for DVDs is quite high and many hardware DVD players can
do at least a little more than the max allowed in the DVD specs. It's not
that hard to encode something (especially from a high quality source, like a
ripped DVD, as opposed to an analog tv capture) and not exceed the maxrate.
It is a much bigger problem for SVCD, because of the much lower max bitrate
allowed from CD-R media vs DVD-R media. It's easy for someone to encode a DVD
and have it work in their player even when vrc_maxrate doesn't work.
More information about the MEncoder-users
mailing list