diff --git a/libavformat/isom.h b/libavformat/isom.h
index 542b76b..fde15c9 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -126,6 +126,8 @@ typedef struct MOVStreamContext {
     int wrong_dts;        ///< dts are wrong due to huge ctts offset (iMovie files)
     int width;            ///< tkhd width
     int height;           ///< tkhd height
+    int display_width;    ///< width to override display of video
+    int display_height;   ///< height to override display of video
     int dts_shift;        ///< dts shift when ctts is negative
     uint32_t palette[256];
     int has_palette;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 222166e..360acf9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2156,6 +2156,15 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                       sc->time_scale, sc->stts_data[0].duration, INT_MAX);
     }
 
+    /*
+        If a display width / height are set we need to set a proper aspect
+        ratio as Quicktime uses this to force the size of the video.
+    */
+    if (sc->display_width)
+        st->sample_aspect_ratio = av_d2q(
+            ((double) sc->display_width / sc->display_height) /
+            ((double) sc->width / sc->height), INT_MAX);
+
     switch (st->codec->codec_id) {
 #if CONFIG_H261_DECODER
     case CODEC_ID_H261:
@@ -2592,6 +2601,35 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     return 0;
 }
 
+static int mov_read_clef(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+    /*
+        Track Clean Aperture Dimensions - overrides other dimensions and
+        aspect ratio information.
+    */
+    unsigned int width;
+    unsigned int height;
+    AVStream *st;
+    MOVStreamContext *sc;
+
+    avio_skip(pb, 2); /* flags */
+    width = avio_rb32(pb); /* cleanApertureWidth */
+    height = avio_rb32(pb); /* cleanApertureHeight */
+
+    av_log(c->fc, AV_LOG_DEBUG, "clef atom read, forcing size to %ux%u\n",
+           width, height);
+
+    if (c->fc->nb_streams < 1)
+        return 0;
+    st = c->fc->streams[c->fc->nb_streams-1];
+    sc = st->priv_data;
+
+    sc->display_width = width;
+    sc->display_height = height;
+
+    return 0;
+}
+
 static const MOVParseTableEntry mov_default_parse_table[] = {
 { MKTAG('A','P','R','G'), mov_read_aprg },
 { MKTAG('a','v','s','s'), mov_read_avss },
@@ -2650,6 +2688,8 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
 { MKTAG('c','m','o','v'), mov_read_cmov },
 { MKTAG('c','h','a','n'), mov_read_chan }, /* channel layout */
 { MKTAG('d','v','c','1'), mov_read_dvc1 },
+{ MKTAG('t','a','p','t'), mov_read_default },
+{ MKTAG('c','l','e','f'), mov_read_clef },
 { 0, NULL }
 };
 
