diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index 91bcdcd99e2599677ba571727f29b96d9ccedc43..3533c52e7949f4485bbff546f47e909d7ae5592f 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -39,7 +39,7 @@ static int framecrc_write_header(struct AVFormatContext *s)
         }
     }
 
-    return ff_framehash_write_header(s);
+    return ff_framehash_write_header(s, 1);
 }
 
 static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
diff --git a/libavformat/framehash.c b/libavformat/framehash.c
index a8357b04ae4d7d2b09d2400d6d3ea112583e665b..7431d45c22e2629ee24370fd40fae9a33eb63900 100644
--- a/libavformat/framehash.c
+++ b/libavformat/framehash.c
@@ -20,7 +20,7 @@
 
 #include "internal.h"
 
-int ff_framehash_write_header(AVFormatContext *s)
+int ff_framehash_write_header(AVFormatContext *s, int version)
 {
     int i;
 
@@ -28,7 +28,22 @@ int ff_framehash_write_header(AVFormatContext *s)
         avio_printf(s->pb, "#software: %s\n", LIBAVFORMAT_IDENT);
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
+        AVCodecParameters *avctx = st->codecpar;
         avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den);
+        if (version > 1) {
+            avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(avctx->codec_type));
+            avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(avctx->codec_id));
+            switch (avctx->codec_type) {
+            case AVMEDIA_TYPE_AUDIO:
+                avio_printf(s->pb, "#sample_rate %d: %d\n", i,avctx->sample_rate);
+                avio_printf(s->pb, "#channel_layout %d: %"PRIx64"\n", i,avctx->channel_layout);
+                break;
+            case AVMEDIA_TYPE_VIDEO:
+                avio_printf(s->pb, "#dimensions %d: %dx%d\n", i, avctx->width, avctx->height);
+                avio_printf(s->pb, "#sar %d: %d/%d\n", i, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
+                break;
+            }
+        }
         avio_flush(s->pb);
     }
     return 0;
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index ef886a04a0caedd4d4c8eabff6cc90cc1daac78c..614c8157a57ee6cf4b5a399eec7c2f2d31741982 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -57,7 +57,7 @@ static void hash_finish(struct AVFormatContext *s, char *buf)
 #if CONFIG_HASH_MUXER || CONFIG_FRAMEHASH_MUXER
 static const AVOption hash_options[] = {
     { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "sha256"}, 0, 0, ENC },
-    { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 1, ENC },
+    { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, ENC },
     { NULL },
 };
 #endif
@@ -65,7 +65,7 @@ static const AVOption hash_options[] = {
 #if CONFIG_MD5_MUXER || CONFIG_FRAMEMD5_MUXER
 static const AVOption md5_options[] = {
     { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "md5"}, 0, 0, ENC },
-    { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 1, ENC },
+    { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, ENC },
     { NULL },
 };
 #endif
@@ -158,7 +158,7 @@ static int framehash_write_header(struct AVFormatContext *s)
     avio_printf(s->pb, "#format: frame checksums\n");
     avio_printf(s->pb, "#version: %d\n", c->format_version);
     avio_printf(s->pb, "#hash: %s\n", av_hash_get_name(c->hash));
-    ff_framehash_write_header(s);
+    ff_framehash_write_header(s, c->format_version);
     avio_printf(s->pb, "#stream#, dts,        pts, duration,     size, hash\n");
     return 0;
 }
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 1719deb219ce46e7dff58c64fb8415bd6a529657..8e0cb34d7624a5a5956b36826cc343763f21d8e4 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -401,7 +401,7 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
  * Set the timebase for each stream from the corresponding codec timebase and
  * print it.
  */
-int ff_framehash_write_header(AVFormatContext *s);
+int ff_framehash_write_header(AVFormatContext *s, int version);
 
 /**
  * Read a transport packet from a media file.