[MPlayer-dev-eng] [PATCH] -oac copy with ac3 sound and lavf ts demuxer issues (Was: Re: [MEncoder-users] Video/Audio asynchronous)

Matthias Hopf mat at mshopf.de
Sat Feb 24 18:41:42 CET 2007

On Feb 24, 07 17:51:35 +0100, Michael Niedermayer wrote:
> > nBlockAlign at least is, thanks a lot!
> > wBitsPerSample is not, as codec->bits_per_sample is already 0.
> hmm if bits_per_sample=0 works fine too? then ill ignore this

You can ;)
It seems to be irrelevant for AC3 frames.
And it should be because the real number of bits per sample actually
depends on the decoder.

> > With current SVN, audio is detected, but not really played, and supposed
> > file duration is way off (too long).
> > 
> > I rechecked, and first stumbled over another issue: lavf thinks this
> > video is 1920x1080 at 59.96fps(!), while mpegts detects 29.976. I called
> > the lavf calls with -ofps 30000/1001 in order to ignore this for now.
> well if lavf says 60000/1001 then i would suspect that to be true
> telecined mpeg specifies frames based on such a timebase

I've never seen 60000/1001 for 1080i in my life (don't know if it's even
part of the standard), only for 720p. And the video does seem to be
30fps not 60, because with lavf mencoder creates a lot of duplicated

> it would be interresting to look the frame lengths (dts difference)
> if there are 2 different legths with 2/3 ratio then 60000/1001 is correct

I'll probably take a look at that in the near future.

> > > note dwSampleSize MUST be 0 for VBR streams
> > 
> > I think I understand *that* part of avi...
> > 
> >          - If the dwSampleSize is 0, then it's VBR stream, so its bitrate
> >          isn't constant. It means that 1 chunk stores 1 sample, and
> >          dwRate/dwScale gives the chunks/sec value.
> > 
> > So how can I check the chunk size? One AC3 frame is 1152 in this
> > case (384kbit/s), but where is this stored?
> well you can easily find the size in bytes of each chunk, just search for 
> 00dc the size is the 32bit int afterwards after that comes the next chunk

No, I mean in which field in codec or sh_aud I can find this value.
I have the AC3 spec at hand and have already written my own
demultiplexer ;)

> also the chunk sizes and their content MUST match from what lavf gives
> mencoder and what mencoder stored in the stream copy case with vbr, this
> is what i suspect will not be true and likely what causes the problems
> mencoder is full of hacks to workaround its own bugs sadly they break
> fatally if correct data is feeded to it ...

I guess so. Unfortunately I don't know how it should behave in the first
place, so I've got difficulties to fix this correctly.

So if you could tell me what the correct values for dwRate/dwScale are
for this stream / how I can determine the correct values, I'll try my
best to find them.



Matthias Hopf <mhopf at suse.de>      __        __   __
Maxfeldstr. 5 / 90409 Nuernberg   (_   | |  (_   |__          mat at mshopf.de
Phone +49-911-74053-715           __)  |_|  __)  |__  R & D   www.mshopf.de

More information about the MPlayer-dev-eng mailing list