[MPlayer-users] Re: Green Screen: tv and bt848

D Richard Felker III dalias at aerifal.cx
Wed Sep 17 08:21:58 CEST 2003

On Tue, Sep 16, 2003 at 11:48:47PM -0500, Jonathan Rogers wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> D Richard Felker III wrote:
> >Input may vary with your particular card; for me, 0 is the tuner. The
> >outfmt isn't absolutely required, but because of bugs/design flaws in
> >bttv, it butchers the interlacing in yv12 (default) mode.
> That's very interesting, since I've just been experimenting with 
> recording from my bt878 card using bttv and mencoder. I'd been setting 
> it to YV12, since that's what most codecs seem to want. The image looks 
> fine, but detc doesn't work perfectly on film sources. It mostly works, 
> but there are jerks and comb artifacts every once in a while. I assumed 
> it was just because of noise. Do you think it will work better if I use 
> YUY2?

>From what I'm told, the author of bttv either doesn't understand
interlacing or doesn't care to implement it right, so when you set the
card in "yv12" mode, you get a proper interlaced 480-line (or 576
w/pal) luma plane, but you get the full 240-line upper chroma field in
the chroma planes, with the lower field thrown away entirely!! The
correct way to deliver interlaced yv12, of course, is to also
interlace the chroma planes, giving two 120-line fields. The way bttv
does it, half of your fields are missing their chroma plane, so they
have to be thrown away or you'll have bogus output.

If you're using an interpolating deinterlace filter (li or ci) then
you can apply it to the luma plane only and you might get tolerable
output from bttv's pseudo-yv12. Semi-interpolating ones (md and fd)
might also work. But if you keep the interlacing, blend it away, or
perform inverse telecine, you'll get horrible chroma ghosts where the
chroma planes don't match the luma image they get paired with, or
perhape horrible combing artifacts in the chroma planes in the inverse
telecine case.

So, unless bttv is fixed, the only working way to capture video from
it is to use yuy2 mode and convert to yv12 for encoding... And be
aware that this conversion must either be done *after* deinterlacing
is complete, or it must be performed in a way which respects the
interlacing of the chroma channels, e.g.:

    -vf il=:d,scale,format=yv12,il=:i

If you just use -vf scale, the scaler will scale down the chroma
planes to 1/2 height while ignoring the fact that they're interlaced,
blending the fields together and ruining your video. In the above
example, the "il" filter is used to deinterleave the chroma fields
before converting to yv12, then reinterleave them after the scaling is

Ideally mplayer (G2 maybe?) should have a scaler/converter that can
handle interlaced video natively, and a means by which filters can
determine whether the video they're receiving is interlaced or
progressive (AFAIK mpeg2 has special headers to identify which way
chroma should be interpreted).


More information about the MPlayer-users mailing list