Opened 8 years ago
Closed 8 years ago
#6420 closed defect (fixed)
hwaccel cuvid breaks B-Frames with h264_nvenc
Reported by: | Andreas Håkon | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | cuvid, h264_cuvid, h264_nvenc |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When you transcode using h264_cuvid for deconding and h264_nvenc for encoding, if you enable "hwaccel cuvid" for a full GPU processing, then you can't enable B-frames.
This works (decode h264_cuvid / encode h264_nvenc + 1 B-Frames):
% ffmpeg -c:v h264_cuvid -i <inputfile> \ -c:v h264_nvenc -bf:v 1 -c:a copy <outputfile>
This doesn't work (decode h264_cuvid / encode h264_nvenc + 1 B-Frames / hwaccel cuvid enabled):
% ffmpeg -hwaccel cuvid -c:v h264_cuvid -i <inputfile> \ -c:v h264_nvenc -bf:v 1 -c:a copy <outputfile>
However, this works (decode h264_cuvid / encode h264_nvenc + No B-Frames / hwaccel cuvid enabled):
% ffmpeg -hwaccel cuvid -c:v h264_cuvid -i <inputfile> \ -c:v h264_nvenc -bf:v 0 -c:a copy <outputfile>
The error when it fails is
[h264_nvenc @ 0x2f43120] EncodePicture failed!: no encode device (1)
So, when you use "-hwaccel cuvid" is imposible to use B-Frames.
Attachments (2)
Change History (7)
comment:1 by , 8 years ago
Keywords: | cuvid h264_cuvid h264_nvenc → cuvid, h264_cuvid, h264_nvenc |
---|
comment:2 by , 8 years ago
comment:3 by , 8 years ago
Hi,
Sorry to hear that it's a known bug!
I need to do a full GPU processing, and this breaks completly the chain: as without B-Frames no good quality.
Any workaround?
by , 8 years ago
Attachment: | af1761f7b5b1b72197dc40934953b775c2d951cc.log added |
---|
Log from first bad commit
comment:4 by , 8 years ago
I was about to file a bug because I have encountered this same problem (almost I'm using mpeg2_cuvid). This is a regression in ffmpeg. I was able to do full hw-transcoding with ffmpeg v3.2.4, but not in latest git.
I performed a git-bisect and the first bad commit is: af1761f7b5b1b72197dc40934953b775c2d951cc
This is the commandline I used for the git-bisect:
FFREPORT=file=$logfile.log:level=99 ./ffmpeg -report -v 9 -hwaccel cuvid -c:v mpeg2_cuvid \ -i $INFILE -c:v h264_nvenc -rc-lookahead 24 -bf 3 \ $OUTFILE 2>&1 | tee $logfile.cli.log
With this I get an error about not having enough surfaces, but if I change the cli, then I can get the error about not having an encoding device.
I don't know the ffmpeg source very well, but based on the comment from the commit there was a change in how input files are initially probed. I believe that changed how cuvid is initialized which leads to there being no free surfaces.
I have attached the log from the suspect commit. I can provide other logs from my git-bisect if requested.
by , 8 years ago
Attachment: | 4ee5aed122ba7d289c1686eca6eba161d5d62304.log added |
---|
Log from last good commit
comment:5 by , 8 years ago
Component: | undetermined → avcodec |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Yes, this is known.
We are pretty sure that the bug in question is on Nvidias end though.
If you feed cuda frames to nvenc by using hwupload_cuda, bframes work as expected, so this can't be a bug in the ffmpeg CUDA frame input code in nvenc, leaving only a weird driver bug.