diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 1a8e5ee239016c9e1544ad6f91372893f57d9902..9e2f812d7c71fe8f5ee8fe5ede350505bc3c8ff5 100644
--- a/libavutil/audioconvert.c
+++ b/libavutil/audioconvert.c
@@ -192,3 +192,13 @@ uint64_t av_get_default_channel_layout(int nb_channels)
     default: return 0;
     }
 }
+
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+                                        uint64_t channel)
+{
+    if (!(channel_layout & channel) ||
+        av_get_channel_layout_nb_channels(channel) != 1)
+        return AVERROR(EINVAL);
+    channel_layout &= channel - 1;
+    return av_get_channel_layout_nb_channels(channel_layout);
+}
diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h
index 35a1a087f68f1bca15883869278c55f097b75432..6f6b4447ef2239674a3245dc899f94670cca0e6c 100644
--- a/libavutil/audioconvert.h
+++ b/libavutil/audioconvert.h
@@ -143,6 +143,18 @@ int av_get_channel_layout_nb_channels(uint64_t channel_layout);
  */
 uint64_t av_get_default_channel_layout(int nb_channels);
 
+/**
+ * Get the index of a channel in channel_layout.
+ *
+ * @param channel a channel layout describing exactly one channel which must be
+ *                present in channel_layout.
+ *
+ * @return index of channel in channel_layout on success, a negative AVERROR
+ *         on error.
+ */
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+                                        uint64_t channel);
+
 /**
  * @}
  */