diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b6917a0a7ddfecdb49f158074052da398c23a1bd..9658b67ab671089d78cdfc3faeb7a5964581c282 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4548,6 +4548,12 @@ const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
  */
 const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
 
+/**
+ * @return codec descriptor with the given name or NULL if no such descriptor
+ *         exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
+
 /**
  * @}
  */
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 2ace53b4d044884b5f0d254bce0ce761b1170daf..30a4e4a778614730998b9e4dd50686579be07a8e 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -16,6 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "avcodec.h"
 
 #include "libavutil/common.h"
@@ -1939,3 +1941,14 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev)
         return prev + 1;
     return NULL;
 }
+
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name)
+{
+    const AVCodecDescriptor *desc = NULL;
+
+    while ((desc = avcodec_descriptor_next(desc))) {
+        if (!strcmp(desc->name, name))
+            return desc;
+    }
+    return NULL;
+}