-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add option to set the value of libvmaf's n_threads option, deprecate .pkl model files #27
Conversation
Thanks for providing the PR – that's much appreciated! I'll review it tomorrow. |
…ltsHelpFormatter takes care of this
I only have a few minor changes to add, otherwise it's good to merge. But: It does not work with ffmpeg installed via Homebrew, since that bundles libvmaf < 2.0, and so it won't work with the If I don't specify a model path at all, it'll try to load a model from So, where does the average user who downloads the static builds, get the JSON model files? Also, the ffmpeg documentation still seems outdated to me, as it mentions |
I was thinking about submitting an additional PR later, with the model files added in a folder named
If the above is done, we can set the default path of the model file to be
I'd mention in the README that the linked binaries should be used, as FFmpeg installed via Homebrew only supports libvmaf <v2.0.0. support for which has been deprecated (I would deprecate support for FFmpeg installed via Homebrew, for the reasons below):
Support for Homebrew ffmpeg can be re-added if/when Homebrew ffmpeg gets libvmaf v2+ support. Alternatively, we can keep Homebrew ffmpeg, but if Homebrew ffmpeg is detected, show a message saying that If you're happy with all/some of the above, let me know and I can submit a PR, or multiple PRs:
Yes, it is. The description for |
Those are all very good suggestions, thanks! I like Homebrew ffmpeg, since it integrates well with my workflow, and it supports nonfree libraries, but I realize it would be way easier to just go with the static builds. Feel free to propose a PR with those changes. I appreciate your input. We should turn also fix the Dockerfile. I can have a look at that after that set of changes. |
I made an edit to my last comment:
Would you prefer this option? The message can be added under Edit: After seeing Also, do you want the |
Yes, in that sense, it's already backwards compatible with current Homebrew and newer static builds. When bundling the model files, we need to consider that they must be shipped with a pip installation, and if the tool is installed with pip, that it can find the model files wherever it's installed. The easiest would be to place that folder inside the folder with the other Python files. I think it also needs some changes in setup.py to include them in the installation (have to verify that one, I'm just on a phone at the moment). |
See am example of such package data here: https://github.com/itu-p1203/itu-p1203/blob/master/setup.py#L40 |
The main changes are as follows:
I have added the option of setting the value of libvmaf's
n_threads
option.Since libvmaf v2.0.0, only 1 thread is used for VMAF calculation by default. See this. This means that, by default, VMAF calculation is not as fast as it can be for those with multi-core CPUs.
Therefore, I have set the default value of
n_threads
to what Python'sos.cpu_count()
method returns. But users can set a different value by using the-nt
/--n-threads
argument.I have edited the README to replace
vmaf_v0.6.1.pkl
withvmaf_v0.6.1.json
as .pkl model files have been deprecated since libvmaf v2.0.0. I have also added links to FFmpeg binaries (for Linux, macOS and Windows) that use libvmaf >v2.0.0.These changes to the README fulfil the following goals in Issue Deprecate VMAF 1.x #19: