diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 8d0a6fcc09..c17299722f 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -202,11 +202,14 @@ fail:
  * retrieve the device with type specified by devtype and return the
  * pointer to the object found in *pfilter.
  * If pfilter is NULL, list all device names.
+ * If device_list is not NULL, populate it with found devices instead of
+ * outputting device names to log
  */
 static int
 dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum,
                     enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype,
-                    IBaseFilter **pfilter, char **device_unique_name)
+                    IBaseFilter **pfilter, char **device_unique_name,
+                    AVDeviceInfoList** device_list)
 {
     struct dshow_ctx *ctx = avctx->priv_data;
     IBaseFilter *device_filter = NULL;
@@ -238,6 +241,7 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum,
         IBindCtx *bind_ctx = NULL;
         LPOLESTR olestr = NULL;
         LPMALLOC co_malloc = NULL;
+        AVDeviceInfo* device = NULL;
         int i;
 
         r = CoGetMalloc(1, &co_malloc);
@@ -282,8 +286,24 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum,
                 // success, loop will end now
             }
         } else {
-            av_log(avctx, AV_LOG_INFO, " \"%s\"\n", friendly_name);
-            av_log(avctx, AV_LOG_INFO, "    Alternative name \"%s\"\n", unique_name);
+            if (device_list) {
+                device = av_mallocz(sizeof(AVDeviceInfo));
+                if (!device)
+                    goto fail1;
+
+                device->device_name = av_strdup(friendly_name);
+                device->device_description = av_strdup(unique_name);
+                if (!device->device_name || !device->device_description)
+                    goto fail1;
+
+                if (av_dynarray_add_nofree(&(*device_list)->devices,
+                                           &(*device_list)->nb_devices, device) < 0)
+                    goto fail1;
+            }
+            else {
+                av_log(avctx, AV_LOG_INFO, " \"%s\"\n", friendly_name);
+                av_log(avctx, AV_LOG_INFO, "    Alternative name \"%s\"\n", unique_name);
+            }
         }
 
 fail1:
@@ -312,6 +332,39 @@ fail1:
     return 0;
 }
 
+static int dshow_get_device_list(AVFormatContext* avctx, AVDeviceInfoList* device_list)
+{
+    struct dshow_ctx* ctx = avctx->priv_data;
+    ICreateDevEnum* devenum = NULL;
+    int r;
+    int ret = AVERROR(EIO);
+
+    if (!device_list)
+        return AVERROR(EINVAL);
+
+    CoInitialize(0);
+
+    r = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
+        &IID_ICreateDevEnum, (void**)&devenum);
+    if (r != S_OK) {
+        av_log(avctx, AV_LOG_ERROR, "Could not enumerate system devices.\n");
+        goto error;
+    }
+
+    ret = dshow_cycle_devices(avctx, devenum, VideoDevice, VideoSourceDevice, NULL, NULL, &device_list);
+    if (ret < S_OK)
+        goto error;
+    ret = dshow_cycle_devices(avctx, devenum, AudioDevice, AudioSourceDevice, NULL, NULL, &device_list);
+
+error:
+    if (devenum)
+        ICreateDevEnum_Release(devenum);
+
+    CoUninitialize();
+
+    return ret;
+}
+
 /**
  * Cycle through available formats using the specified pin,
  * try to set parameters specified through AVOptions and if successful
@@ -713,7 +766,7 @@ dshow_list_device_options(AVFormatContext *avctx, ICreateDevEnum *devenum,
     char *device_unique_name = NULL;
     int r;
 
-    if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_unique_name)) < 0)
+    if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_unique_name, NULL)) < 0)
         return r;
     ctx->device_filter[devtype] = device_filter;
     if ((r = dshow_cycle_pins(avctx, devtype, sourcetype, device_filter, NULL)) < 0)
@@ -773,7 +826,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
         av_log(avctx, AV_LOG_INFO, "Capture filter loaded successfully from file \"%s\".\n", filename);
     } else {
 
-        if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_filter_unique_name)) < 0) {
+        if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_filter_unique_name, NULL)) < 0) {
             ret = r;
             goto error;
         }
@@ -1130,9 +1183,9 @@ static int dshow_read_header(AVFormatContext *avctx)
 
     if (ctx->list_devices) {
         av_log(avctx, AV_LOG_INFO, "DirectShow video devices (some may be both video and audio devices)\n");
-        dshow_cycle_devices(avctx, devenum, VideoDevice, VideoSourceDevice, NULL, NULL);
+        dshow_cycle_devices(avctx, devenum, VideoDevice, VideoSourceDevice, NULL, NULL, NULL);
         av_log(avctx, AV_LOG_INFO, "DirectShow audio devices\n");
-        dshow_cycle_devices(avctx, devenum, AudioDevice, AudioSourceDevice, NULL, NULL);
+        dshow_cycle_devices(avctx, devenum, AudioDevice, AudioSourceDevice, NULL, NULL, NULL);
         ret = AVERROR_EXIT;
         goto error;
     }
@@ -1335,6 +1388,7 @@ const AVInputFormat ff_dshow_demuxer = {
     .read_header    = dshow_read_header,
     .read_packet    = dshow_read_packet,
     .read_close     = dshow_read_close,
+    .get_device_list= dshow_get_device_list,
     .flags          = AVFMT_NOFILE,
     .priv_class     = &dshow_class,
 };
