diff --git a/doc/APIchanges b/doc/APIchanges
index 18e8d5e46ca76b497778c7913bd0b17780f98205..cf8d82892bea92b1c1be55c41b0638d95ac77028 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil:     2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - xxxxxxx - lavc 56.13
+  Add width, height, coded_width, coded_height and format to
+  AVCodecParserContext.
+
 2015-xx-xx - xxxxxxx - lavu 54.9.0
   Add AV_PIX_FMT_QSV for QSV hardware acceleration.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 231b92bd663262cc036ab9c1e0c7b8a67b87bc4a..5b5c21f2c892e143aeb5d6ff17e912c206d69f2d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3883,6 +3883,28 @@ typedef struct AVCodecParserContext {
      * For example, this corresponds to H.264 PicOrderCnt.
      */
     int output_picture_number;
+
+    /**
+     * Dimensions of the decoded video intended for presentation.
+     */
+    int width;
+    int height;
+
+    /**
+     * Dimensions of the coded video.
+     */
+    int coded_width;
+    int coded_height;
+
+    /**
+     * The format of the coded data, corresponds to enum AVPixelFormat for video
+     * and for enum AVSampleFormat for audio.
+     *
+     * Note that a decoder can have considerable freedom in how exactly it
+     * decodes the data, so the format reported here might be different from the
+     * one returned by a decoder.
+     */
+    int format;
 } AVCodecParserContext;
 
 typedef struct AVCodecParser {
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 693af003098b52f71a7bf15195abb350ee9f8448..21e320d7527e5276a5bdce7ceefc0f54fbb750a1 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -275,6 +275,35 @@ static inline int parse_nal_units(AVCodecParserContext *s,
             h->sps       = *h->sps_buffers[h->pps.sps_id];
             h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
 
+            s->coded_width  = 16 * h->sps.mb_width;
+            s->coded_height = 16 * h->sps.mb_height;
+            s->width        = s->coded_width  - (h->sps.crop_right + h->sps.crop_left);
+            s->height       = s->coded_height - (h->sps.crop_top   + h->sps.crop_bottom);
+            if (s->width <= 0 || s->height <= 0) {
+                s->width  = s->coded_width;
+                s->height = s->coded_height;
+            }
+
+            switch (h->sps.bit_depth_luma) {
+            case 9:
+                if (CHROMA444(h))      s->format = AV_PIX_FMT_YUV444P9;
+                else if (CHROMA422(h)) s->format = AV_PIX_FMT_YUV422P9;
+                else                   s->format = AV_PIX_FMT_YUV420P9;
+                break;
+            case 10:
+                if (CHROMA444(h))      s->format = AV_PIX_FMT_YUV444P10;
+                else if (CHROMA422(h)) s->format = AV_PIX_FMT_YUV422P10;
+                else                   s->format = AV_PIX_FMT_YUV420P10;
+                break;
+            case 8:
+                if (CHROMA444(h))      s->format = AV_PIX_FMT_YUV444P;
+                else if (CHROMA422(h)) s->format = AV_PIX_FMT_YUV422P;
+                else                   s->format = AV_PIX_FMT_YUV420P;
+                break;
+            default:
+                s->format = AV_PIX_FMT_NONE;
+            }
+
             avctx->profile = ff_h264_get_profile(&h->sps);
             avctx->level   = h->sps.level_idc;
 
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 0a5c2cae33c197671aeaf1ff7e44ebd229d588c2..4404d97d67f7cb942302178831f639a34d502ed4 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -89,6 +89,8 @@ found:
     s->dts_sync_point       = INT_MIN;
     s->dts_ref_dts_delta    = INT_MIN;
     s->pts_dts_delta        = INT_MIN;
+    s->format               = -1;
+
     return s;
 }
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e3168c4a8e2e32a8b41ad77cbec889aebcde4a1a..d58e3298c67724e91bee5f747a05b689c6a16194 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR 12
+#define LIBAVCODEC_VERSION_MINOR 13
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \