Skip to content
Permalink
Browse files

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.
  • Loading branch information
philipl committed Jun 17, 2017
1 parent 1edbf5e commit 472d5a58d3676b2c906c10bab04484a511d4eaf2
Showing with 9 additions and 0 deletions.
  1. +1 −0 ffmpeg.h
  2. +6 −0 ffmpeg_cuvid.c
  3. +2 −0 ffmpeg_opt.c
@@ -67,6 +67,7 @@ enum HWAccelID {
HWACCEL_VIDEOTOOLBOX,
HWACCEL_QSV,
HWACCEL_VAAPI,
HWACCEL_CUDA,
HWACCEL_CUVID,
};

@@ -33,6 +33,12 @@ int cuvid_init(AVCodecContext *avctx)
AVHWFramesContext *frames_ctx;
int ret;

av_log(avctx, AV_LOG_WARNING,
"The 'cuvid' hwaccel is deprecated in favour of the 'cuda' "
"hwaccel. When switching to 'cuda', you must specify the "
"output format using '-hwaccel_output_format cuda' to get "
"the same transcoding configuration as 'cuvid'.\n");

av_log(avctx, AV_LOG_VERBOSE, "Initializing cuvid hwaccel\n");

if (!hw_device_ctx) {
@@ -93,6 +93,8 @@ const HWAccel hwaccels[] = {
#if CONFIG_CUVID
{ "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA,
AV_HWDEVICE_TYPE_NONE },
{ "cuda", hwaccel_decode_init, HWACCEL_CUDA, AV_PIX_FMT_CUDA,
AV_HWDEVICE_TYPE_CUDA },
#endif
{ 0 },
};

0 comments on commit 472d5a5

Please sign in to comment.