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

f_auto_filters: don't set interlaced-only for userdeint #14839

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

kasper93
Copy link
Contributor

Not wanted apparently: #14822 (comment)

@kasper93
Copy link
Contributor Author

@hooke007: Does this fixes playback of your file?

@llyyr
Copy link
Contributor

llyyr commented Sep 13, 2024

Why do we want to enable deinterlacing for frames not flagged as interlaced?

@hooke007
Copy link
Contributor

hooke007 commented Sep 13, 2024

Why do we want to enable deinterlacing for frames not flagged as interlaced?

That's what deinterlace=yes designed for. interlaced-only=yes cannot fix for the wrong encoded frames.

@hooke007
Copy link
Contributor

But I agree that now the new value auto was added. interlaced-only=yes should work with auto

@llyyr
Copy link
Contributor

llyyr commented Sep 13, 2024

I looked at it more, and it seems that before auto was added, yes worked basically the same way as auto except the check was done in refqueue not in auto filters. https://github.com/mpv-player/mpv/blob/master/video/filter/refqueue.c#L107

Right now both auto and yes are actually the same option, so I agree with removing this to allow forcing deinterlacing for every frame if that's what the user wants.

However, I noticed another issue. With the current implementation of auto, we destroy the subfilter for every frame that's not interlaced then recreate it when we have an interlaced frame again. This is probably not very efficient. I think the auto option should be reworked to just set interlaced-only=yes and with yes we should set interlaced-only=no

bwdif_cuda and bwdif_vulkan have different syntax but they can do this too https://ffmpeg.org/ffmpeg-all.html#bwdif_005fvulkan

I'll whip up a PR for this

@llyyr
Copy link
Contributor

llyyr commented Sep 13, 2024

I have something that works but the only problem is that deinterlace-active property can't exist anymore, how much do we care about it?

@Dudemanguy
Copy link
Member

It's not that important but why can't it exist anymore? The output chain should be able to access all filters.

@llyyr
Copy link
Contributor

llyyr commented Sep 13, 2024

It's not that important but why can't it exist anymore? The output chain should be able to access all filters.

Currently, we just check by seeing if the filter is inserted or not. After #14841, with auto the filter is always inserted and we don't know what it is actually doing with the frames.

@hooke007
Copy link
Contributor

Hmm, if the source file is marked p, auto shouldn't insert the filter.

@llyyr
Copy link
Contributor

llyyr commented Sep 14, 2024

auto shouldn't insert the filter.

Whether the filter is inserted or not doesn't matter, if the frames themselves aren't marked as interlaced then the filter won't do anything. Inserting and removing filters is expensive and leads to stutters when it happens, so I think avoiding that should be the priority.

@hooke007
Copy link
Contributor

Inserting and removing filters is expensive

It was caused by mpv's internal design. Of course it's expensive when you check it each frame.
But what I point out it here is that the check should be only once for each video track.

@llyyr
Copy link
Contributor

llyyr commented Sep 14, 2024

Patches for a better solution are welcome

check it each frame.

This is necessary because the concept of an "interlaced file" does not exist, interlacing is frame data and only exist as frame data. You can't mark entire file as interlaced, what you're doing is marking each individual frame as interlaced. There exist files that have some interlaced frames but not all

@hooke007
Copy link
Contributor

Have no idea how mediainfo could do.
I will test if performance was affected when filtet was insert even though it doesn't deint.

@llyyr
Copy link
Contributor

llyyr commented Sep 14, 2024

Have no idea how mediainfo could do.

mediainfo reports a file is interlaced if at least 1 frame in it is interlaced. Actually it depends on the file format but I'm not interested in reading 20 year old C++ code.

@kasper93 kasper93 merged commit e41ee05 into mpv-player:master Sep 15, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants