FFMPEG with nvenc and nvresize

Hi,

I am trying to compile ffmpeg with --enable-nvenc and --enable-nvresize. I have manage to get a build with nvenc but when I try to apply the patch (http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/ffmpeg_NVIDIA_gpu_acceleration.patch) I keep getting the following error:

Checking patch configure…
error: while searching for:
–enable-decklink enable Blackmagick DeckLink I/O support [no]
–enable-mmal enable decoding via MMAL [no]
–enable-nvenc enable NVIDIA NVENC support [no]
–enable-openal enable OpenAL 1.1 capture support [no]
–enable-opencl enable OpenCL code
–enable-opengl enable OpenGL rendering [no]

error: patch failed: configure:276
error: configure: patch does not apply
Checking patch libavcodec/Makefile…
Hunk #1 succeeded at 108 (offset 10 lines).
Checking patch libavcodec/nvenc.c…
Hunk #12 succeeded at 430 (offset 1 line).
Hunk #13 succeeded at 448 (offset 1 line).
Hunk #14 succeeded at 630 (offset 1 line).
Hunk #15 succeeded at 714 (offset 1 line).
error: while searching for:
ctx->encode_config.frameFieldMode = NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME;
}

switch (avctx->codec->id) {
case AV_CODEC_ID_H264:
    ctx->encode_config.encodeCodecConfig.h264Config.h264VUIParameters.colourDescriptionPresentFlag = 1;

error: patch failed: libavcodec/nvenc.c:865
error: libavcodec/nvenc.c: patch does not apply
Checking patch libavcodec/nvenc_ptx.c…
Checking patch libavfilter/Makefile…
Hunk #1 succeeded at 209 (offset 29 lines).
Checking patch libavfilter/allfilters.c…
Hunk #1 succeeded at 306 (offset 34 lines).
Checking patch libavfilter/vf_nvresize.c…
Checking patch libavfilter/vf_nvresize_ptx.c…

I have followed the nvidia manual to do this and read this forum but I cannot manage to do it. Does anyone had this error before?

Many thanks,
Kind regards.

Hi again,

After some further debugging, I have find out that this is due to the changes in the FFMPEG code. The latest FFMPEG version in the git repo seems to be different from what the patch is looking for and that is why is cannot find some parts of the code.

Does anyone face this problem before? Which FFMPEG version is compatible with this patch?

Many thanks,
Kind regards.

Hi
You need to run “git log” under ffmpeg directory.
then find the target version of ffmpeg which Nvidia’s document based on .

See?Here the Nvidia’s document give a git commit-id which this sample based on.

After “git clone” ffmpeg ,run command “git revert --HARD b83c849e8797fbb972ebd7f2919e0f085061f37f”
and then “git apply” as below.

  1. Apply the NVIDIA acceleration patch. Note that this patch was created against the
    git master commit:
    commit b83c849e8797fbb972ebd7f2919e0f085061f37f
    Date: Tue Nov 10 04:14:55 2015 +010
    ~/Development/ffmpeg $ git apply …/ffmpeg_NVIDIA_gpu_acceleration.patch

git apply …/ffmpeg_NVIDIA_gpu_acceleration.patch

error: patch failed: configure:276
error: configure: patch does not apply
error: patch failed: libavcodec/nvenc.c:25
error: libavcodec/nvenc.c: patch does not apply

Is it critical ?

“git revert --HARD b83c849e8797fbb972ebd7f2919e0f085061f37f” doesn`t work

(thanks for helping me out)