[MPlayer-dev-eng] [PATCH] -oac copy with ac3 sound and lavf ts demuxer issues (Was: Re: [MEncoder-users] Video/Audio asynchronous)
michaelni at gmx.at
Tue Feb 20 17:25:50 CET 2007
On Tue, Feb 20, 2007 at 12:25:35AM +0100, Matthias Hopf wrote:
> I noted (and participated) in a discussion on mencoder-users, that
> probably fits much better in mplayer-dev-eng now.
> You'll find a summary of the discussion that lead to this at the end of
> this mail. You might want to read it first if the summary doesn't make
> sense to you.
> - "-demuxer lavf" breaks "-oac copy" subtly - still works with mplayer
> and xine, but not on any other player I tried
> - remuxing doesn't help
> - the extracted ac3 looks good (5.1 channel ac3, no broken packets)
> - the extracted ac3 from the broken avi is exactly the same as the
> extracted ac3 from the original file
> - Sample uploaded as lavf_copy_broken_audio_hdtv.ts
> - Patch attached, but not to be applied without *major* revision
> The sample is only 1MB, at 1080i, which gives you only approx 1 second
> of video and audio, but that's enough for the tests. Not for A/V sync
> issues, but that seems to work out fine as later tests show.
> Now I've compared the avi files that were produced by choosing lavf and
> mpegts demuxers, and it showed, that mpegts produced a constant bitrate
> stream (dwSampleSize = 1), while lavf produced a VBR stream. Also,
> nBlockAlign, wBitsPerSample, nSamplesPerSecond wasn't set by lavf.
> nChannels is set differently (2 by mpegts, 6 by lavf), but that is
> irrelevant, and lavf is IMHO actually doing the right thing here.
> The culprit for not finding any audio at all in the other players I
> tried (compared to xine and mplayer which both found audio) was the
> missing nBlockAlign. Additionally, without setting/changing the constant
> bitrate information (dwSampleSize, dwRate, dwScale), stream duration was
> way off, and no sound was actually heard (though at least detected). I
> didn't really try to create correct VBR settings here, though, but just
> copied the ones from the avi created by mpegts.
> With this information I finally created the attached patch, which fixes
> the issues for me. Though I hardly know what I'm doing in this area. In
> fact, it should be considered rather a discussion base than a real patch.
> But it *did* fix *my* problems (except for wrong wBitsPerSample, which
> is cosmetic only) so far, and I get perfectly synchronous video and
> audio with it. So far.
> So the remaining question is basically twofold:
> - Why is nBlockAlign, wBitsPerSample not set correctly?
should be fixed, please test
> - 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 ...
note dwSampleSize MUST be 0 for VBR streams
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the MPlayer-dev-eng