Failed unlocking input buffer!: generic error (20)

Hi Everyone,

I’m using FFmpeg based NVENC encoding on a GTX 1060 and just upgraded from version 385.69 to 390.77/ Windows 10 64 Bit.

I am encoding content as nvenc_hevc, the source is a H.264/AVC mpegts stream.

The stream runs fine for about 5 minutes and then produces this error in FFmpeg.

If I downgrade the driver to 385.69 or below the encoding works fine, if I use anything above 385.69 I get this issue.

So the problem appears to be in the driver support/SDK.

I can reproduce this issue and have found other users who are experiencing the same issue.

Please see here:-

Any Ideas? Is this a known bug?

Hi trevormdnqv,

We suspect that this could be a bug. Could you provide us with the following information:

  1. GPU (GTX 1080?)
  2. Platform & OS details
  3. Application in use and source code
  4. Driver version
  5. Detailed reproduction instructions
  6. input bit-stream and exact ffmpeg command line

Ryan Park

Hi Ryan,

GTX 1060 driver version 390.77/ Windows 10 64 Bit.

Using the latest FFMPEG git build compiled for use in a Windows Environment.

As per my ticket above, this issue appears to occur with all drivers after 385.69 and has been reported by other users.

Using these parameters with an mpeg-ts input and mpeg-ts output will persistently reproduce the error with FFmpeg

-c:v hevc_nvenc profile:v rext -preset:v slow -rc vbr_hq -rc-lookahead 58 -surfaces 64 -temporal-aq 1 -spatial-aq 1 -aq-strength 6 …

I’ve been experiencing the same issue for a while.

  1. GPU: GTX 1080
  2. Platform/OS: Windows 10 Pro 64-bit (10.0, Build 16299)
  3. Application in use: ffmpeg version N-89471-g88e2dc7d04
  4. Driver version:
  5. ffmpeg command: ffmpeg -y -loglevel info -hide_banner {source} -map 0:v -c:v hevc_nvenc -preset medium -cq:v 34 -rc:v vbr_hq -rc-lookahead 32 -no-scenecut 1 -init_qpP 23 -init_qpB 25 -init_qpI 21 -weighted_pred 1 -map 0:a -c:a copy {file}

Hi Fireundubh,

Thanks for confirming the issue.

If you revert back to driver 385.69 this provides a temporary fix.

Hopefully the Nvidia development team will get on top of this issue as it has been around for a while.

I will try nudging Ryan from their team for an urgent fix.

Hi Ryan,

Is there any update on this bug please?

Hi Ryan,

Can I get an update please?

Hi Ryan,

Can I please have an update on this issue or can you put me in touch with someone who can help?

It’d be nice if NVIDIA fixed this.

This issue remains current with driver 397.64.

This issue remains current with driver 397.93.

[hevc_nvenc @ 0000011b67126300] Failed unlocking input buffer!: generic error (20)
Video encoding failed
[AVIOContext @ 0000011b67140040] Statistics: 54 seeks, 178 writeouts
[hevc_nvenc @ 0000011b67126300] Nvenc unloaded
[AVIOContext @ 0000011b671275c0] Statistics: 129873998 bytes read, 2 seeks
Conversion failed!

Don’t worry about it.
The issue is caused by “weight-p”. For unknown reason (probably nvidia driver spectre patch), using weight-p will cause nvenc to produce that error.

Weight-p will work perfectly with older driver 385.69 before the drivers spectre patch.

The sample had been provided to Nvidia Video Team. I just hope the software engineer can replicate the issue.

Look at the other thread.