[FFmpeg-devel] [PATCH] avcodec/nvenc : fix hw accelerated transcode with bframes
timo at rothenpieler.org
Fri Jun 2 22:48:01 EEST 2017
Am 02.06.2017 um 19:47 schrieb Ganapathy Raman Kasi:
> HW accelerated transcode (h264_cuvid -> h264_nvenc with -hwaccel cuvid) was broken after the filtergraph initialization was changed to intialize decoder first followed by encoder (commit af1761f7b5b1b72197dc40934953b775c2d951cc). During initialzing encoder with bframes, local buffers are allocated internally in encoder which fails since no cuda context is bound to current cpu thread. Now pushing the correct cuda context before encoder initialization fixes the issue. Also adding push/pop cuda ctx during create/destroy/map/unmap resources and destroy encoder session.
Will also backport to affected release branches.
What I'm still wondering is, how did this ever happen to work?
I suspected something like this, and verified that we were not leaking a
bound context somewhere, and thus gave up on that trail.
Changing the order of initialization, or rather throwing initializing
cuvid before nvenc, seems to be what causes this.
More information about the ffmpeg-devel