diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 26fe1d683fedca284426fecd8e7d5b74692a9d11..c385a2f1f82d43cc051eb786cf8773373c46e655 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -230,6 +230,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int
                                                        h + (pad->h - pad->in_h));
     int plane;
 
+    picref->video->w = w;
+    picref->video->h = h;
+
     for (plane = 0; plane < 4 && picref->data[plane]; plane++) {
         int hsub = (plane == 1 || plane == 2) ? pad->hsub : 0;
         int vsub = (plane == 1 || plane == 2) ? pad->vsub : 0;