[mythtv] dvb zero length record

Daniel Kristjansson danielk at cat.nyu.edu
Mon Jun 6 13:27:58 UTC 2005


On Mon, 2005-06-06 at 14:11 +0100, John Pullan wrote:
> On 06/06/05, Daniel Kristjansson <danielk at cat.nyu.edu> wrote:
> > On Mon, 2005-06-06 at 20:56 +1000, Phil Vid wrote:
> > > This has been resolved by turning off the 'Wait for SEQ Start Header'
> > > flag in the DVB card setup. Thanks Will Uther for suggesting this fix.
> > > Unfortunately I don't have any experience with MPEG video stream
> > > decoding, so is anyone able to explain why this is necessary and what
> > > the purpose of the sequence frame wait is?
> > We try to wait for the sequence start header as a proxy for waiting for
> > the first I frame. The reason we want to wait for the first I frame is
> > two fold: first ffmpeg used to crash the program when you didn't, second
> > if you don't wait for the first I frame then you can get weird visual
> > effects as partial P and B frames arrive before the first full frame.
> > 
> <snip>
> 
> So assuming that this is Phil's issue, does this imply that the
> detection code is broken in some way. If so how can we debug it to get
> to the bottom of the problem ?

Hmm, originally we looked for a GOP. But GOPs are optional in MPEG-2,
and some broadcasters weren't using it. I believe we thought Sequence
headers were always there. So either this assumption is wrong, or we
need to parse more than the first TS packet of a PES Packet. This could
be the case if the AFC offset is close to or greater than 183, so the
start of the PES packet is not actually contained in the first TS
packet. This is a totally valid condition we don't account for in
DTVRecorder::FindKeyframes(). Checking for if this is the case is just
a matter of adding this before the for loop:
  if (tspacket->AFCOffset() >= 100)
    VERBOSE(VB_IMPORTANT, "DTVR::FindKeyFrames(): "
            "AFC offset is too large for us.");

If a few of these are printed out when you get a zero length recording,
then you've found the culprit.

If we were somehow wrong about Sequence headers always being there,
then we could look for the I frame picture start code instead of the
Sequence header.

-- Daniel



More information about the mythtv-dev mailing list