diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 11a019483abdcf187bb731c178eb146f99152efb..be4629acff9a9583cda9701dffc2e723e5f014cb 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -431,6 +431,19 @@ VLC_API picture_t *picture_Clone(picture_t *pic);
 VLC_API int
 picture_AttachAncillary(picture_t *pic, struct vlc_ancillary *ancillary);
 
+/**
+ * Allocate a new ancillary and attach it to a picture. Helper equivalent to
+ * malloc + vlc_ancillary_Create + picture_AttachAncillary. The returned memory
+ * is not initialized.
+ *
+ * @param pic picture to attach created ancillary to
+ * @param id id of the ancillary to create
+ * @param size allocation size in bytes
+ * @return The allocated pointer on success, NULL on out-of-memory
+ */
+VLC_API void *
+picture_AttachNewAncillary(picture_t *pic, vlc_ancillary_id id, size_t size);
+
 /**
  * Return the ancillary identified by an ID
  *
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index fc12de9651dd86b5ddeed3b66882d09bf65dea97..d7c8228636006117a9b4395d7a563092a1af030c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -309,6 +309,7 @@ net_SetCSCov
 net_Write
 NTPtime64
 picture_AttachAncillary
+picture_AttachNewAncillary
 picture_BlendSubpicture
 picture_Clone
 picture_CopyPixels
diff --git a/src/misc/picture.c b/src/misc/picture.c
index d281b1eff3bd482a5373c6a2c7d574d25bb5869b..8b42b2c0b8d3bafa4646460a36a6dc7aebc06b33 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -479,6 +479,27 @@ picture_AttachAncillary(picture_t *pic, struct vlc_ancillary *ancillary)
     return vlc_ancillary_array_Insert(&priv->ancillaries, ancillary);
 }
 
+void *
+picture_AttachNewAncillary(picture_t *pic, vlc_ancillary_id id, size_t size)
+{
+    void *data = malloc(size);
+    if (!data)
+        return NULL;
+
+    struct vlc_ancillary *ancillary = vlc_ancillary_Create(data, id);
+    if (!ancillary) {
+        free(data);
+        return NULL;
+    }
+
+    if (picture_AttachAncillary(pic, ancillary) != 0) {
+        vlc_ancillary_Release(ancillary);
+        return NULL;
+    }
+
+    return data;
+}
+
 struct vlc_ancillary *
 picture_GetAncillary(const picture_t *pic, vlc_ancillary_id id)
 {