diff mbox

[FFmpeg-devel] avcodec/nvenc: multiple reference frames

Message ID !&!AAAAAAAAAAAYAAAAAAAAAPVpP4J8X/dMswzQa6NNRVPCgAAAEAAAAFuhRCMLwENIrmSnbgkeGw4BAAAAAA==@gmail.com
State New
Headers show

Commit Message

hydra3333@gmail.com Oct. 27, 2019, 12:14 a.m. UTC
> On 14.10.2019 18:56 Timo Rothenpieler wrote:
> > On 14.10.2019 17:43, Hendrik Leppkes wrote:
> > > Since some users seem to have blindly passed -refs to their
> > > commandline which now fails without really telling them why, any
> > > thoughts on moving the capability check error messages onto a high log
> > > level so that they are shown by default, since they are the source of
> > > a failure to encode?
> > > 
> > > -  Hendrik
> > 
> > Maybe all errors in nvenc_check_capabilities should be warnings instead 
> > of verbose even?
>
> Warning: newbie user-submitted patch attached for your consideration.
>
> Context: https://trac.ffmpeg.org/ticket/8254 
> The option -refs works OK on newest models of nvidia graphics cards
> however fails with a slightly obscure (to a user) error message on 
> common but lesser models of nvidia graphics cards (eg 1050Ti).
>
> The attached patch seeks to slightly modify relevant error messages
> and change error messages in nvenc_check_capabilities to be issued
> as warnings instead of verbose.
>
> Thank you for considering the patch.
>
>  << File: ffmpeg_ncenc_messages_patch_20191027.patch >> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: winmail.dat
> Type: application/ms-tnef
> Size: 20154 bytes
> Desc: not available
> URL:
<http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191027/501d91c0/atta
chment.bin>

I see the attachment (attached by outlook) was scrubbed. 
Sorry, I'd hoped it would work.
So, patch just pasted below to see if that works.

         return AVERROR(ENOSYS);
@@ -369,46 +369,46 @@
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE);
     if (IS_10BIT(ctx->data_pix_fmt) && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "10 bit encode not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "10 bit encode not supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD);
     if (ctx->rc_lookahead > 0 && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "RC lookahead not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "RC lookahead not supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ);
     if (ctx->temporal_aq > 0 && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "Temporal AQ not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "Temporal AQ not supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION);
     if (ctx->weighted_pred > 0 && ret <= 0) {
-        av_log (avctx, AV_LOG_VERBOSE, "Weighted Prediction not
supported\n");
+        av_log (avctx, AV_LOG_WARNING, "Weighted Prediction not
supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_CABAC);
     if (ctx->coder == NV_ENC_H264_ENTROPY_CODING_MODE_CABAC && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "CABAC entropy coding not
supported\n");
+        av_log(avctx, AV_LOG_WARNING, "CABAC entropy coding not
supported\n");
         return AVERROR(ENOSYS);
     }
 
 #ifdef NVENC_HAVE_BFRAME_REF_MODE
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
     if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1) {
-        av_log(avctx, AV_LOG_VERBOSE, "Each B frame as reference is not
supported\n");
+        av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not
supported\n");
         return AVERROR(ENOSYS);
     } else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret ==
0) {
-        av_log(avctx, AV_LOG_VERBOSE, "B frames as references are not
supported\n");
+        av_log(avctx, AV_LOG_WARNING, "B frames as references are not
supported\n");
         return AVERROR(ENOSYS);
     }
 #else
     if (ctx->b_ref_mode != 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "B frames as references need SDK 8.1
at build time\n");
+        av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1
at build time\n");
         return AVERROR(ENOSYS);
     }
 #endif
@@ -416,12 +416,13 @@
 #ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES);
     if(avctx->refs != NV_ENC_NUM_REF_FRAMES_AUTOSELECT && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "Multiple reference frames are not
supported\n");
+        av_log(avctx, AV_LOG_WARNING, 
+               "Multiple reference frames are not supported by the
device\n");
         return AVERROR(ENOSYS);
     }
 #else
     if(avctx->refs != 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "Multiple reference frames need SDK
9.1 at build time\n");
+        av_log(avctx, AV_LOG_WARNING, "Multiple reference frames need SDK
9.1 at build time\n");
         return AVERROR(ENOSYS);
     }
 #endif
@@ -458,7 +459,7 @@
 
     av_log(avctx, loglevel, "[ GPU #%d - < %s > has Compute SM %d.%d ]\n",
idx, name, major, minor);
     if (((major << 4) | minor) < NVENC_CAP) {
-        av_log(avctx, loglevel, "does not support NVENC\n");
+        av_log(avctx, AV_LOG_WARNING, "does not support NVENC\n");
         goto fail;
     }
 
@@ -601,7 +602,8 @@
             return AVERROR_EXIT;
 
         if (!dl_fn->nvenc_device_count) {
-            av_log(avctx, AV_LOG_FATAL, "No NVENC capable devices
found\n");
+            av_log(avctx, AV_LOG_FATAL, 
+                   "No NVENC capable devices found, or requested feature
not supported by the device\n");
             return AVERROR_EXTERNAL;
         }

Comments

Nicolas Frattaroli Oct. 27, 2019, 12:29 a.m. UTC | #1
On 27.10.19 02:14, hydra3333@gmail.com wrote:
> I see the attachment (attached by outlook) was scrubbed. 
> Sorry, I'd hoped it would work.
> So, patch just pasted below to see if that works.
> 

Please use git send-email. It's the easiest way to properly send patches to the list.
diff mbox

Patch

--- a/libavcodec/nvenc.c	2019-10-26 16:18:38.688412000 -0700
+++ b/libavcodec/nvenc.c	2019-10-26 16:34:12.825972419 -0700
@@ -321,39 +321,39 @@ 
 
     ret = nvenc_check_codec_support(avctx);
     if (ret < 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "Codec not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "Codec not supported\n");
         return ret;
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE);
     if (IS_YUV444(ctx->data_pix_fmt) && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "YUV444P not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "YUV444P not supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE);
     if (ctx->preset >= PRESET_LOSSLESS_DEFAULT && ret <= 0) {
-        av_log(avctx, AV_LOG_VERBOSE, "Lossless encoding not supported\n");
+        av_log(avctx, AV_LOG_WARNING, "Lossless encoding not supported\n");
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_WIDTH_MAX);
     if (ret < avctx->width) {
-        av_log(avctx, AV_LOG_VERBOSE, "Width %d exceeds %d\n",
+        av_log(avctx, AV_LOG_WARNING, "Width %d exceeds %d\n",
                avctx->width, ret);
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_HEIGHT_MAX);
     if (ret < avctx->height) {
-        av_log(avctx, AV_LOG_VERBOSE, "Height %d exceeds %d\n",
+        av_log(avctx, AV_LOG_WARNING, "Height %d exceeds %d\n",
                avctx->height, ret);
         return AVERROR(ENOSYS);
     }
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_NUM_MAX_BFRAMES);
     if (ret < avctx->max_b_frames) {
-        av_log(avctx, AV_LOG_VERBOSE, "Max B-frames %d exceed %d\n",
+        av_log(avctx, AV_LOG_WARNING, "Max B-frames %d exceed %d\n",
                avctx->max_b_frames, ret);
 
         return AVERROR(ENOSYS);
@@ -361,7 +361,7 @@ 
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_FIELD_ENCODING);
     if (ret < 1 && avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
-        av_log(avctx, AV_LOG_VERBOSE,
+        av_log(avctx, AV_LOG_WARNING,
                "Interlaced encoding is not supported. Supported level:
%d\n",
                ret);