Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pullup: Cannot find a way to say “bottom field first” #2289

Closed
ion1 opened this issue Sep 6, 2015 · 8 comments
Closed

pullup: Cannot find a way to say “bottom field first” #2289

ion1 opened this issue Sep 6, 2015 · 8 comments

Comments

@ion1
Copy link
Contributor

ion1 commented Sep 6, 2015

I was unable to find a way to play frames_of_reference.mpeg in mpv without telecine artifacts. --field-dominance does not seem to affect pullup. None of the parameters to pullup seem to help either. autodeint.lua was also unable to come up with a working filter.

I was able to get the video corrected to various extents with ffmpeg:

  • detelecine=first_field=b:start_frame=1 would remove all artifacts until going out of sync towards the end of the video.
  • fieldmatch=order=bff,decimate would remove most artifacts throughout the video, leaving an interlaced frame here and there.
  • fieldmatch=order=bff:combmatch=full,yadif=deint=interlaced,decimate would fix many of those frames but not all.

I suppose mpv pullup with a field dominance override would be more or less equivalent to the second filter? I would be happy with that.

I’m running mpv git-eabc530.

@richardpl
Copy link
Contributor

use setfield filter before pullup

@ion1
Copy link
Contributor Author

ion1 commented Sep 6, 2015

Thanks! For future reference, I got good results (similar to the ffmpeg output) with

mpv --vf=lavfi=\"setfield=bff,pullup,dejudder\"

Perhaps mpv could provide a higher-level setting that is documented in the man page. But if you deem this use case too obscure, feel free to just close the request.

@kevmitch
Copy link
Member

kevmitch commented Sep 7, 2015

so --field-dominance=bottom doesn't work for pullup?

@kevmitch
Copy link
Member

kevmitch commented Sep 7, 2015

oh, duh, yeah, that's what you said. yeah, this should work, looking into it now.

@kevmitch
Copy link
Member

kevmitch commented Sep 7, 2015

Well the only place that vf_pullup.c references the field dominance is
in filter_frame(AVFilterLink *inlink, AVFrame *in) and that is definitely influenced by setting --field-dominance in mpv.

It looks like some of the supposedly progressive frames in the 2-3 pattern are actually interlaced. So even if pullup could perfectly figure what to make of it, you'd still get interlaced frames. You're probably better off just using yadif on it.

@ion1
Copy link
Contributor Author

ion1 commented Sep 8, 2015

With ffmpeg, detelecine=first_field=b:start_frame=1 (which to my knowledge is not adaptive but blindly goes through the motions of inverse telecine) seemed to remove all the artifacts until going out of sync minutes later. This would seem to indicate a pure 2-3 pattern.

The adaptive filters (fieldmatch+decimate and pullup) seemed to fail occasionally, but had way better results than yadif. The failure frames were infrequent enough not to ruin the experience.

Both --vf=lavfi=\"setfield=bff,pullup\" and --vf=lavfi=\"setfield=bff\",pullup worked but I also had to add dejudder to make the motion smooth.

(Is pullup ever better than pullup,dejudder? Should the mpv pullup filter perhaps activate both unconditionally?)

@kevmitch
Copy link
Member

kevmitch commented Sep 8, 2015

It looks like one of the problems with that clip is that all the frames are flagged progressive, so the field dominance is actually being ignored in vf_pullup.c even though it is being correctly set by --field-dominance in mpv. The parity calculation in vf_pullup.c is

p = in->interlaced_frame ? !in->top_field_first : 0;

The reason that --vf=lavfi=[setfield=bff,pullup] works better is that setfield has the side effect of also unconditionally flagging all frames as interlaced so that the field dominance will actually be honoured. @wm4 should the --field-dominance option do the same, should there be a separate option to reflag frames as interlaced/progressive, or should we just continue the status quo where this has to be done in lavfi somehow?

That said, I still find that yadif is at least required at the end to make that clip watchable --vf=lavfi=[setfield=bff,pullup,dejudder,yadif] due to the significant residual combing.

@ghost
Copy link

ghost commented Sep 8, 2015

I wonder about that. Just using setfield seems like a decent solution too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants