[MPlayer-dev-eng] [PATCH] new mpeg muxer

D Richard Felker III dalias at aerifal.cx
Fri Feb 25 02:23:21 CET 2005


On Fri, Feb 25, 2005 at 01:09:33AM +0100, Nico Sabbi wrote:
> D Richard Felker III wrote:
> 
> >
> >the "correct" way, as far as i'm concerned, is to encode at 24fps, but
> >then modify the output stream to indicate 30fps and to add tff/repeat
> >flags to alternating frames so as to emulate 24fps inside a 30fps
> >stream, aka "soft telecine". i'm not sure whether this nasty hackery
> >belongs in the encoder or in the muxer, though...
> >
> > 
> >
> 
> if I understand correctly I should
> 1) patch the fps to 29.97 or 30
> 2) always disable progressive sequence (lavc always sets it)
> 3) leave progressive frame as is
> 4) every frame must have either TFF or RFF, so when they are not
> set I should alternate them every two frames?
> and what when TFF is always set?
> 
> 
> Can someone confirm or correct?
> A link to a complete explanation would help a lot, thanks.

i'll explain.
first of all, this should all be an option that has to be explicitly
enabled.

now the scenario is you're getting in video at 23.976 or 24 fps.
i'm not sure of the difference between progressive sequence versus
progressive frame flags. presumably all of these are set to true by
the encoder.
input frames should all have the same field parity set, either tff=1
or tff=0, not alternating. rff should always be 0.

if any of the above conditions on the input stream fail to hold (i.e.
you don't really have progressive video suitable for telecine) it's
probably good to bail out with an error or at least print nasty
warnings.

now what to do:

replace the fps by 29.97 or 30, respectively.
alternatively set rff=1 on every second frame.
keep a running value for tff flag, initializing it with 1 (or the
value from the first input frame) and alternate it after each time you
use rff=1, always storing your tff flag in place of the one in the
source video.

so the final rff and tff flag pattern should come out looking like:
rff 0101010101010101
tff 1100110011001100
(note: you can just keep a counter "mod 4" and use bit-0 as rff, bit-1
as tff.. :)

i don't know what to do with the progressive sequence/frame flags.
billy biggs (vektor on freenode; sometimes he posts to this list) has
done quite a bit of research on this subject and can probably tell you
the correct values, as well as all the incorrect ones used on
countless badly mastered dvds out there... :)

rich





More information about the MPlayer-dev-eng mailing list