David Tombs <[email protected]> added the comment:

Here's a patch that outputs a bit more specific info about what failed.

________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2311>
________________________________________________
Index: libavcodec/libvorbis.c
===================================================================
--- libavcodec/libvorbis.c	(revision 25680)
+++ libavcodec/libvorbis.c	(working copy)
@@ -60,24 +60,57 @@
 };
 static const AVClass class = { "libvorbis", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
 
+/**
+ * @return string describing oggvorbis error nums:
+ *  OV_EFAULT
+ *  OV_EINVAL
+ *  OV_EIMPL
+ */
+static av_cold const char * vorbisenc_strerror(int errnum)
+{
+    switch (errnum)
+    {
+    case OV_EFAULT:
+        return "internal vorbis error";
+    case OV_EINVAL:
+        return "invalid request";
+    case OV_EIMPL:
+        return "unimplemented mode";
+    default:
+        return "unknown error";
+    }
+}
+
 static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
     OggVorbisContext *context = avccontext->priv_data ;
     double cfreq;
+    int vorbis_ret;
 
     if(avccontext->flags & CODEC_FLAG_QSCALE) {
         /* variable bitrate */
-        if(vorbis_encode_setup_vbr(vi, avccontext->channels,
+        if(vorbis_ret = vorbis_encode_setup_vbr(vi, avccontext->channels,
                 avccontext->sample_rate,
-                avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))
+                avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0)) {
+
+            av_log(avccontext, AV_LOG_WARNING,
+                    "vorbis_encode_setup_vbr: %s\n",
+                    vorbisenc_strerror(vorbis_ret));
+
             return -1;
+        }
     } else {
         int minrate = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;
         int maxrate = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1;
 
         /* constant bitrate */
-        if(vorbis_encode_setup_managed(vi, avccontext->channels,
-                avccontext->sample_rate, minrate, avccontext->bit_rate, maxrate))
+        if(vorbis_ret = vorbis_encode_setup_managed(vi, avccontext->channels,
+                avccontext->sample_rate, minrate, avccontext->bit_rate, maxrate)) {
+            av_log(avccontext, AV_LOG_WARNING,
+                    "vorbis_encode_setup_managed: %s\n",
+                    vorbisenc_strerror(vorbis_ret));
+
             return -1;
+        }
 
         /* variable bitrate by estimate, disable slow rate management */
         if(minrate == -1 && maxrate == -1)

Reply via email to