[FFmpeg-user] Why are PTS values different from what's expected?

Mark Filipak (ffmpeg) markfilipak at bog.us
Thu Apr 1 23:50:13 EEST 2021


On 2021-04-01 13:40, pdr0 wrote:
> Mark Filipak (ffmpeg) wrote
>> What I'm trying to do is make a 120000/1001fps cfr in which each frame is
>> a proportionally weighted
>> pixel mix of the 24 picture-per-second original:
>> AAAAA AAAAB AAABB AABBB ABBBB.
>> I'm sure it would be way better than standard telecine -- zero judder --
>> and I'm pretty sure it
>> would be so close to motion vector interpolation that any difference would
>> be imperceptible. I'm
>> also sure that it would be a much faster process than mvinterpolate. The
>> only question would be
>> resulting file size (though I think they would be very close).
> 
> Is this 120000/1001 CFR intended for a 60Hz display? ...

Yes, or a 120Hz display.

Please, correct me if I'm wrong.

The 120fps frames are conveying 24 pictures-per-second, i.e. 5 discrete frames per picture with the 
1st of each set of 5 being an identical duplicate of the original (e.g. AAAAA), so down converting 
to 60fps is not a simple case of dropping alternate frames (i.e. 5/2 is not an integer).
The lines below are: 24FPS / 120FPS / 60FPS (BY ALTERNATE FRAME DROP).
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.CCCCCCCCCCCCCCCCCCCCCCCCCCCCC.DDDDD...
AAAAA.AAAAB.AAABB.AABBB.ABBBB.BBBBB.BBBBC.BBBCC.BBCCC.BCCCC.CCCCC.CCCCD.CCCDD.CCDDD.CDDDD.DDDDD...
AAAAA.AAABB.ABBBB.BBBBC.BBCCC.CCCCC.CCCDD.CDDDD.DDDDE.DDEEE.EEEEE.EEEFF.EFFFF.FFFFG.FFGGG.GGGGG...

Note how, in the 60FPS stream, there is no BBBBB or DDDDD or FFFFF frames. That continues and any 
loss of 'pure' frames would probably be noticeable. ...UPDATE: The loss is noticeable (as flicker).

My cheap 60Hz TV accepts 120fps and it apparently interpolates during down conversion to 60fps. I 
assume that's true of all 60Hz TVs because, given that the frames are sent to the TV as raw frames 
via HDMI, doing pixel interpolation in real time within the TV is a snap, so all 60Hz TVs probably 
do it fine.

>... Do you decimate by 2 to make it 60000/1001 after ?

I haven't tried because I haven't gotten a 120fps that doesn't have PTS errors. But since there are 
no identical frames, I don't think decimation will do anything.

> "proportionally weighted pixel mix" it sounds like a standard frame blended
> conversion . eg. You drop a 23.976p asset on a 120000/1001fps timeline in a
> NLE and enable frame blending. Or in avisynth it would be
> ConvertFPS(120000,1001)

Well, I don't know what "NLE" means, so you'll need to enlighten me. I found one such ffmpeg filter 
-- I can't remember its name -- but it only added 1 frame of interpolated pixels between 2 original 
frames, not 4 frames between 2 input frames.

> This zip file example has the original 24000/1001, weighted frame blending
> to 120000/1001, and decimation to 60000/1001 - is this something close to
> what you had in mind ?
> https://www.mediafire.com/file/qj819m3vctx4o4q/blends_example.zip/file

Oops... It appears I've already responded to this post, so I've gotten my email threads mixed up. 
(So, what else is new, eh?) I must have gotten the new email notice for a different incoming.

One last thing: I didn't even try '-vf fps=fps=120000/1001' because I assumed that the TV would be 
'smart' and would decimate it and then telecine. I just tried it. I was right. Oh, dear. At least 
what I'm trying to do is on the right track, but I reckon that the frame cross-fades (via 'mix' 
weights) need to be non-linear, perhaps something like this:

If I can resolve the problems with my approach, I have some other schemes to try.

First, let me redefine AAAAA.AAAAB.AAABB.AABBB.ABBBB.BBBBB as
5A0B.4A1B.3A2B.2A3B.1A4B.0A5B.

Then, using that notation, how about these?
5A1B.4A2B.3A3B.3A3B.2A5B.1A5B [note 1]
9A1B.5A5B.7A3B.3A7B.5A5B.1A9B [note 2]

[note 1] Might produce some additional fuzzing (but less noticeable flicker) for fast motion, but 
less fuzzing as A & B approach identity (i.e. slower motion).

[note 2] Might produce a small, 48fps judder in exchange for doubling the flicker rate (which might 
be less noticeable).

Have you tried either of those?

Another thing I've discovered in the past is that using a checkerboard mix in lieu of a blended mix 
looks much sharper -- perhaps this is a "trick of the eye", human perception thing.

I'd like to try all of the above, but first I need to get my filter complex working (which means 
solving its PTS errors (which means discovering the effect on PTS of various filters (which means 
more experimenting because the documentation is silent on the issue))). I'm 74 years old and I hope 
I can get all this sorted out and my movie collection converted before I wind up in the retirement 
home that will undoubtedly be my ultimate residence.  ...So much to do; so little (Mark)x(time). :-)


More information about the ffmpeg-user mailing list