[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 15:58:17 CET 2007


On Feb 20, 07 17:25:50 +0100, Michael Niedermayer wrote:
> > - Why is nBlockAlign, wBitsPerSample not set correctly?
> 
> should be fixed, please test

nBlockAlign at least is, thanks a lot!
wBitsPerSample is not, as codec->bits_per_sample is already 0.

> > - Why is dwRate/dwScale/dwStart/dwLength/dwSuggestedBufferSize wrong?
> >   What are the right values?
> >   I assume codec->frame_size and/or codec->sample_rate are wrong.
> >   lavf gets it right for constant bit rate, but an unknown ac3 stream is
> >   inherrently variable, so a VBR approach is the right thing (TM) to do.
> > 
> > Can anyone with a deeper understanding how demuxing in mplayer actually
> > works comment on my findings?
> 
> without checking i would say mplayer is wrong and the rate/scale from lavf
> is correct, sadly you dont say which values the wrong and correct variables
> actually had so its hard to say for sure ...

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.

I analyzed the two avi streams, and found the following values in the
headers to differ:

                                   lavf           mpegts
dwTotalFrames                      $19            $27
dwLength                           $19            $27
   - aud AVI Stream Header
dwScale                            $4             $1
dwRate                             $7d            $bb80
dwStart                            $1             $642
dwLength                           $11            $60aa
dwSuggestedBufferSize              $600           $5dc0
dwSampleSize                       0              1
   - aud AVI Stream Format
nChannels                          6              2
wBitsPerSample                     0              $10

Some variables of lavf:
codec->frame_size                  $600
codec->sample_rate                 $bb80

which sounds perfectly sensible to me (1536 samples for 384kbit/s AC3
packets, 48000 Hz).

> 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?

Thanks

Matthias

-- 
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