FFmpeg/lavfi=[unsharp filter] does not work with yuv420p10 Pixel Format
zexcster opened this issue · comments
IINA v. 1.3.4
Probably because of adding several Unsharp filters to the SavedFilters, clearing the saved list did not help
tried v. 1.3.3, same, used default settings , nothing, blur (negative values) also do not work
The filter worked "yesterday", nothing changed (except the changes in the savedVideofilters),
same video file, HW off.
Removing all saved filters did not help.
And the interesting part is, The filter works on the background (when activated) but does not affect picture at all. How do I know?
If I apply several unsharp filters at once it gets very laggy. But the picture stays unaffected. HW off/auto does not matter.
So when they work correctly all the filters apply together and the video output gets even more affected.
But now unsharp/blur does not affect the picture at all, no matter what value
Flip/Negative filters still work fine.
At this moment I had to use MPV filters from (advanced settings) to activate Sharpen filter, it works (but it always active)
I cannot add the same filter from the Video Filters setting / Custom (MPV). It does not accept the settings.
e.g.
filter name:
Sharpen
value:
4
Is where any way to clear the DB\Settings? Clean re-install?
It is desirable to capture evidence of what is going wrong before attempting to fix the problem by clearing settings.
IINA stores settings using the macOS defaults system. Settings can be accessed using the defaults command in Terminal. Open Terminal and run this command:
defaults read com.colliderli.iina savedVideoFilters
And this command:
defaults read com.colliderli.iina savedAudioFilters
Capture the output and post it here. This is what it looks like when I run these commands:
Video filters:
low-batt@gag ~$ defaults read com.colliderli.iina savedVideoFilters
(
{
filterString = "format=colormatrix=auto:colorlevels=full:convert=no:primaries=auto";
name = format;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "crop=1024:720:0:0";
name = crop;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "lavfi=[unsharp=5:5:0.18171875:5:5:0.18171875]";
name = sharp;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "lavfi=[delogo=w=1:x=1:y=1:h=1]";
name = delogo;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = vflip;
name = flip;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "lavfi=[format=yuv444p,split=4[a][b][c][d],[a]waveform[aa],[b][aa]vstack[V],[c]waveform=m=0[cc],[d]vectorscope=color4[dd],[cc][dd]vstack[V2],[V][V2]hstack]";
name = format2;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "lavfi=[lut3d=interp=trilinear:file=/Users/low-batt/Documents/builds/iina/issue-3620/35 Free LUTs/Faded 47.CUBE]";
name = faded;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "oscilloscope=y=0:x=%3%0.5:s=1";
name = oscilloscope;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "@iina_flip:vflip";
name = vflip;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "crop=200:200::";
name = "custom crop";
shortcutKey = T;
shortcutKeyModifiers = s;
},
{
filterString = "lavfi=[unsharp=5:5:0.159375:5:5:0.159375]";
name = "issue-4930";
shortcutKey = "";
shortcutKeyModifiers = "";
}
)
low-batt@gag ~$
Audio filters:
low-batt@gag ~$ defaults read com.colliderli.iina savedAudioFilters
(
{
filterString = "scaletempo=stride=8:overlap=1:search=10:scale=%3%0.4:speed=pitch";
name = scaletempo;
shortcutKey = "N";
shortcutKeyModifiers = "";
},
{
filterString = "scaletempo=speed=pitch:scale=2:overlap=1:stride=8:search=10";
name = scaletempo;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "@iina_aeq9:lavfi=[anequalizer=c0 f=16000.0 w=13063.945299020566 g=0.0|c1 f=16000.0 w=13063.945299020566 g=0.0]";
name = eq;
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "lavfi=[rubberband=pitch=1.05946]";
name = "Pitch +1";
shortcutKey = "";
shortcutKeyModifiers = "";
},
{
filterString = "scaletempo2=max-speed=16";
name = "mute-at-16x";
shortcutKey = "";
shortcutKeyModifiers = "";
}
)
low-batt@gag ~$
Before attempting to clear the problem it would be good to collect log files, especially the mpv
log file. To enable logging follow these instructions:
- Start IINA
- Click on
Settings…
under theIINA
menu - The settings panel appears
- On the left side of the panel click on
Advanced
- Slide the
Enable advanced settings
toggle button to be on (blue) - Click on the checkbox
Enable logging to file
- Restart IINA to activate logging
Once IINA has restarted, reproduce the problem. Then:
- Click on
Settings…
under theIINA
menu - The settings panel appears
- On the left side of the panel click on
Advanced
- Click on
Open log directory
- A new
Finder
window appears containing the logs for this session - Quit IINA to complete the log files
The Finder
window contains two files, iina.log
and mpv.log
. To attach the log files to this issue, drag-n-drop them from the Finder
window to the Leave a comment
section below. Include both the iina.log
and the mpv.log
The log files can also be accessed using Terminal as shown here:
low-batt@gag com.colliderli.iina$ pwd
/Users/low-batt/Library/Logs/com.colliderli.iina
low-batt@gag com.colliderli.iina$ ls
2022-10-04-17-57-15_jVrbWy
low-batt@gag com.colliderli.iina$ cd 2022-10-04-17-57-15_jVrbWy
low-batt@gag 2022-10-04-17-57-15_jVrbWy$ ls
iina.log mpv.log
low-batt@gag 2022-10-04-17-57-15_jVrbWy$
With logging enabled IINA creates a new log directory each time it is started. If accessing the logs using Terminal
be sure to obtain them from the latest log directory.
DO NOT FORGET to disable logging once you have obtained log files for the problem being investigated. IINA does not restrict the size of log files or delete old logs. If you leave logging enabled the logs will continue to accumulate.
Saved filters can be cleared by deleting the assocated setting:
defaults delete com.colliderli.iina savedVideoFilters
As we don't know what is going wrong, I can't say if that will fix the problem.
Attempting to add a mpv
filter with the name sharpen
and a value of 4
fails because mpv
does not provide a filter named sharpen
. The available filters can be found here.
A value of 4
is accepted by the mpv
sharpen option:
--sharpen=<value>
If set to a value other than 0, enable an unsharp masking filter. Positive values will sharpen the image (but add more ringing and aliasing). Negative values will blur the image.
I believe that option merely provides an easy way of adding a FFmpeg unsharp filter.
Another place filter setting are retained is in the Watch Later file for the video being played. This mpv
feature is used by IINA's somewhat deceptively named Resume last playback position
setting. That setting is enabled by default. It saves more than the playback position.
With that setting enabled, I played a file, applied a filter and quit IINA before reaching the end of the video. I then checked what option values were saved:
low-batt@gag ~$ md5 -qs '/Users/low-batt/Movies/big_buck_bunny.mp4' | xargs -I % cat ~/Library/Application\ Support/com.colliderli.iina/watch_later/%
start=3.350000
pause=yes
volume=42.000000
vf=format=convert=no:colorlevels=full:colormatrix=auto:primaries=auto
low-batt@gag ~$
You can see the video filter (vf
) was saved and will be restored if I play this video again.
The easiest way to clear such files is to disable the Resume last playback position
setting. It is found on the General
tab of IINA's settings in the Behavior
section.
Thank you for answering,
Found the cause, it's the Pixel Format and might be the inbuilt FFmpeg version
yuv420p10 this one ignores sharpening (I have several different files with this code all of them ignores sharpening)
yuv420p this one is ok
2 workarounds
- a long one
to convert the same file with either
ffmpeg -i in_file -filter:v "format=yuv420p" out_file
ffmpeg -i in_file -pix_fmt yuv420p out_file
But it's a realtime process per file, so not really helpful
- a working one
to add a custom FFmpeg filter
Name:
format
Value:
pix_fmts=yuv420p
result:
lavfi=[format=pix_fmts=yuv420p]
you need to activate the "pixels" first and only then any FFmpeg filter affected by Pixel Format
so a temp solution is above