[MPlayer-dev-eng] [PATCH] ae_lavc: set nBlockAlign like libavformat

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Aug 27 21:20:46 CEST 2011


On Sat, Aug 27, 2011 at 08:12:26PM +0200, Nicolas George wrote:
> Le decadi 10 fructidor, an CCXIX, Reimar Döffinger a écrit :
> > frame_size is currently passed vide dwScale.
> > That is quite broken and causes issues, but adding another
> > hack/breakages is not really the right way to go.
> 
> I do not think this is broken. As far as I understand the spec,
> dwScale/dwRate is what, in sane formats, is called the time_base. Therefore,
> setting dwScale=frame_size and dwRate=sample_rate is correct. That is what
> lavf does too, except it reduces the fraction.

No, that is just nonsense for VBR.
This is about the best I found, see the part talking about VBR:
http://www.virtualdub.org/blog/pivot/entry.php?id=27
dwScale/dwRate should be set to how much audio in seconds an audio
frame results in, and nBlockAlign to some "huge" value
(for which I suspect setting to frame_size might be a rather unreliable
substitute).
For the CBR case it really can/should be set to correspond to the byterate,
and nBlockAlign to 1. I think the sample in bug 1958 uses this, and it
is completely broken by how demux_lavf sets up dwScale/dwRate while it
works fine with demuxer mkv.

> > Also demux_lavf should need exactly the same change or stream
> > copy would still not work.
> 
> Stream copy seems indeed currently broken with demux_lavf. The reason may be
> similar, but that does not mean the fix for the first problem can not be
> applied before the fix for the second is found.

As said, I believe the reason for this is that the dwScale/dwRate value
are nonsense, which is possibly the cause for the desync you see.
And if that is changed these nBlockAlign hacks need to be changed if
not right-out reverted.
And in the mean time MPlayer might be producing files that are broken
in yet another way, and I don't think adding to the already vast supply
of broken AVI files is a good idea.


More information about the MPlayer-dev-eng mailing list