Skip to content

Commit

Permalink
ffmpeg: Introduce 'cuda' hwaccel and deprecate 'cuvid'
Browse files Browse the repository at this point in the history
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 472d5a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ enum HWAccelID {
HWACCEL_VIDEOTOOLBOX,
HWACCEL_QSV,
HWACCEL_VAAPI,
HWACCEL_CUDA,
HWACCEL_CUVID,
};

Expand Down
6 changes: 6 additions & 0 deletions ffmpeg_cuvid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions ffmpeg_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};
Expand Down

0 comments on commit 472d5a5

Please sign in to comment.