[ffmpeg] Add NVIDIA Codec feature for Windows and Linux#9171
[ffmpeg] Add NVIDIA Codec feature for Windows and Linux#9171dan-shaw merged 10 commits intomicrosoft:masterfrom
Conversation
|
👍 great pull request |
ports/ffnvcodec/portfile.cmake
Outdated
| vcpkg_from_github( | ||
| OUT_SOURCE_PATH SOURCE_PATH | ||
| REPO FFmpeg/nv-codec-headers | ||
| REF n9.0.18.1 |
There was a problem hiding this comment.
We prefer to use commit id instead of tag name in REF place. Could you please update it?
|
@marcbertola thanks for this PR. |
|
I have tried to compile both versions successfully |
|
I studied the corresponding relationship between cuda SDK and ffnvcodec, and found that ffnvcodec and cuda are subordinate, so ffnvcodec should be installed as a feature of cuda, and the ffnvcodec version should be dynamically determined according to the cuda SDK version during installation. |
|
congruent relationship: |
|
If I understand correctly, ffnvcodec is a set of headers that can be included to dynamically link to the NV codec functions without needing an import library/.dll or the .so while compiling. So yeah, I'm wondering what we should do with this. The Regarding the 10.2 mismatch - @fawdlstty, have you had success with finding the right combination of |
|
I have use cuda 10.2 and ffmpeg n4.2-02d8c63f80, the two ffnvcodec versions compile and run successfully: n9.0.18.1-77b06e328b and n9.1.23.0-c646ab60a8 |
|
This creates a problem: the user's graphics driver must have the latest version installed.If you haven't updated your graphics driver in 2018, you can't use hard coding.Therefore, I think compatibility should be considered. If the developer needs to use cuda9.1, then VCPKG should provide ffnvcodec corresponding to it and indicate ffmpeg version |
|
Hi. I stumbled into this by looking for this exact solution. |
|
Unfortunately, there is more to it than the change request. I didn't have clarity on the following items:
I recently updated my Linux machine to cuda 10.2, so I'll take it for a spin again to see how far I get without modifying ffnvcodec - If I can leave it as is then the issues above go away. I'll look over it today. |
|
Ok, my Linux PC is building with 9.1.23.1. Installing CUDA 10.2 on my Windows PC and I should be able to provide feedback shortly. |
that's my question, it has nothing to do with this PR. I think this request can be merged as soon as possible, if there are special requirements can also modify the port to achieve custom requirements |
|
Ok, I should be able to post an update within the hour that uses the original ffnvcodec version (9.1.23), so it removes some of the uncertainty we had about rolling back the version in this PR. |
|
@NancyLi1013, your requested change has been implemented. I also changed to the ffnvcodec version that was originally used before the PR. |
|
Hi @marcbertola I noticed |
|
Hi @NancyLi1013 |
|
Need to test features. |
ZhengzhongSun
left a comment
There was a problem hiding this comment.
Works for me! It's really helpful to everyone who uses the ffmpeg with nvenc.
|
Sorry for the late reply.
Note: Due to If you can make sure that the new feature Thanks again for your efforts and patience. |
|
I use the feature actively on Linux for my experiments. It works for my purposes (hw acceleratiob for h264 and hevc). Not sure if there are some formal things to check apart from that. My triplet is the x64 linux one, but modified to be dynamic instead of static. |
|
Since vcpkg supports static on Linux. It might be better to make sure this feature work in this case. |
|
Certainly. For the record, there is a great benefit in providing support
for dynamic builds under Linux, especially for LGPL libraries like this one.
…On Tue, Mar 10, 2020, 08:18 NancyLi1013 ***@***.***> wrote:
Since vcpkg supports static on Linux. It might be better to make sure this
feature work in this case.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9171?email_source=notifications&email_token=ABHJD366HFFIOCSFE2MZJYLRGYVX7A5CNFSM4JTPI3C2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLFRXI#issuecomment-597055709>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHJD34QZB2VOGJ4NQEO4GDRGYVX7ANCNFSM4JTPI3CQ>
.
|
|
@NancyLi1013 IMHO, I think this confirms the Linux build. Sorry for the delay, been distracted by the world events :\ |
|
What is the process now to get this merged? Do I need to do anything else? |
dan-shaw
left a comment
There was a problem hiding this comment.
Wow this PR has been open for a while. Let's get this merged. It looks like a change we want, made some comments below.
|
OK, I submitted the comment with the tag and now instruct FFmpeg to find the nvcodec headers in the installed directory. |
dan-shaw
left a comment
There was a problem hiding this comment.
Thanks for the changes, just one more question
ports/ffnvcodec/build.sh
Outdated
| # Copy ffnvcodec.pc to the location in the MSYS environment where pkgconfig | ||
| # expects to find it. | ||
| mkdir -p /usr/lib/pkgconfig | ||
| cp ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/ffnvcodec.pc /usr/lib/pkgconfig |
There was a problem hiding this comment.
Do we need this copy? We are installing packages config in the packages dir for ffnvcodec and ffmpeg is getting it via PKG_CONFIG_PATH
There was a problem hiding this comment.
Hm. This was a long time ago. It think the idea is as follows:
- The FFmpeg portfile invokes build.sh in MSYS
- build.sh which in turn calls FFmpeg's configure, which calls pkg_config
- pkg_config looks for a .pc file for ffnvcodec in the default location.
This last step is the reason why we copy the file to the root /usr/lib/pkgconfig
Now, I guess that if we do away with this copy, we remove a potential build problem. I can think of a situation where the user would decide to purge/reset the msys environment. The ffnvcodec package would still be installed, but the ffmpeg build would fail because the .pc file is no longer in the msys environment.
My question for you is: does vcpkg launch msys with the right PKG_CONFIG_PATH? if so, then yeah, I think we can remove these lines.
I'll give it a try. I'll start with a fresh checkout, remove the offending lines, and try again. I'll let you know.
There was a problem hiding this comment.
If make eventually accepts the PREFIX parameter, and it can run under Windows, then I think we may even be able to dispense with the indirection via the build.sh script in ffnvcodec.
There was a problem hiding this comment.
Ok, I ran into some problems, sorry for any confused back and forth email you may have received.
Contrary to my original impressions, PKG_CONFIG_PATH is set in MSYS, but it is a windows path (ex: C:\blah\blah), which doesn't work in MSYS. Once it was converted using cygpath, it works.
So: yes, these lines can be removed, but PKG_CONFIG_PATH given to MSYS should be converted using cygpath.
There was a problem hiding this comment.
I have submitted a workaround for the cygpath issue along with the removal of the lines.
I used the -p option on cygpath in case it contains multiple directories.
…nstead of /usr/lib/pkgconfig.
|
LGTM, thanks for all those changes. Currently, we are fixing some CI problems before merging this. |
|
@marcbertola Thanks for the PR! |
This is my first vcpkg pull request, I'm very receptive to feedback on how I can do this better!
This change exposes FFmpeg options to enable NVIDIA's hardware codecs.
./vcpkg install ffmpeg[nvcodec]Changes:
Notes to ffnvcodec maintainer ( @NancyLi1013 ? ):