Skip to content

Commit 472d5a5

Browse files
committed
ffmpeg: Introduce 'cuda' hwaccel and deprecate 'cuvid'
We want to switch to using the generic hwaccel codepath but doing that introduces a requirement to pass '-hwaccel_output_format cuda' on the command line to turn on full transcoding. That breaks compatibility, so we'd rather deprecate than cut over directly. But this change doesn't seem to be working. I can specify one of the two hwaccels but the 'cuda' one doesn't seem to work. The context does not get shared between the decoder and encoder. If I reverse the declaration order of the two hwaccels, then 'cuda' works and 'cuvid' does not (cuvid_init isn't even called). I assume this is related to having both of them say they handle the same pix_fmt.
1 parent 1edbf5e commit 472d5a5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

ffmpeg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ enum HWAccelID {
6767
HWACCEL_VIDEOTOOLBOX,
6868
HWACCEL_QSV,
6969
HWACCEL_VAAPI,
70+
HWACCEL_CUDA,
7071
HWACCEL_CUVID,
7172
};
7273

ffmpeg_cuvid.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ int cuvid_init(AVCodecContext *avctx)
3333
AVHWFramesContext *frames_ctx;
3434
int ret;
3535

36+
av_log(avctx, AV_LOG_WARNING,
37+
"The 'cuvid' hwaccel is deprecated in favour of the 'cuda' "
38+
"hwaccel. When switching to 'cuda', you must specify the "
39+
"output format using '-hwaccel_output_format cuda' to get "
40+
"the same transcoding configuration as 'cuvid'.\n");
41+
3642
av_log(avctx, AV_LOG_VERBOSE, "Initializing cuvid hwaccel\n");
3743

3844
if (!hw_device_ctx) {

ffmpeg_opt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ const HWAccel hwaccels[] = {
9393
#if CONFIG_CUVID
9494
{ "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA,
9595
AV_HWDEVICE_TYPE_NONE },
96+
{ "cuda", hwaccel_decode_init, HWACCEL_CUDA, AV_PIX_FMT_CUDA,
97+
AV_HWDEVICE_TYPE_CUDA },
9698
#endif
9799
{ 0 },
98100
};

0 commit comments

Comments
 (0)