diff --git a/ext/dash/gstdashmanager.c b/ext/dash/gstdashmanager.c
index 9bca34e..aa3e64f 100644
--- a/ext/dash/gstdashmanager.c
+++ b/ext/dash/gstdashmanager.c
@@ -19,6 +19,8 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+ 
+#include <string.h>
 
 #include <gst/baseadaptive/gstadaptivefragment.h>
 
@@ -123,12 +125,15 @@ gst_dash_manager_add_stream (GstStreamsManager * b_manager, GstPad * pad,
 {
   GstDashManager *manager;
   G_GNUC_UNUSED GstCaps *caps;
+  GstStructure *str;
   GstCaps *pad_caps;
   guint streams_count = 0;
   const gchar *mime_type, *lang = NULL;
   StreamType type;
   G_GNUC_UNUSED gint fps_n, fps_d;
   gint width = 0, height = 0, par_n = 0, par_d = 0, samplerate = 0;
+  const gchar *profile_str, *level_str;
+  guint8 profile = 0, constraint_set = 0, level = 0;
   guint bitrate = 0;
   gdouble framerate = 0;
   gchar *pad_name;
@@ -159,8 +164,111 @@ gst_dash_manager_add_stream (GstStreamsManager * b_manager, GstPad * pad,
     par_d = gst_discoverer_video_info_get_par_denom (video_info);
     par_n = gst_discoverer_video_info_get_par_num (video_info);
     bitrate = gst_discoverer_video_info_get_bitrate (video_info);
+
     caps = gst_discoverer_stream_info_get_caps (
         (GstDiscovererStreamInfo *) video_info);
+    str = gst_caps_get_structure (caps, 0);
+
+    profile_str = gst_structure_get_string (str, "profile");
+    
+    if (strcmp(profile_str, "constrained-baseline") == 0) {
+        profile = 66;
+        constraint_set = 192;
+    }
+    else if (strcmp(profile_str, "baseline") == 0) {
+        profile = 66;
+    }
+    else if (strcmp(profile_str, "main") == 0) {
+        profile = 77;
+    }
+    else if (strcmp(profile_str, "extended") == 0) {
+        profile = 88;
+    }
+    else if (strcmp(profile_str, "high") == 0) {
+        profile = 100;
+    }
+    else if (strcmp(profile_str, "high-10-intra") == 0) {
+        profile = 110;
+        constraint_set = 64;
+    }
+    else if (strcmp(profile_str, "high-10") == 0) {
+        profile = 110;
+    }
+    else if (strcmp(profile_str, "high-4:2:2-intra") == 0) {
+        profile = 122;
+        constraint_set = 64;
+    }
+    else if (strcmp(profile_str, "high-4:2:2") == 0) {
+        profile = 122;
+    }
+    else if (strcmp(profile_str, "high-4:4:4-intra") == 0) {
+        profile = 244;
+        constraint_set = 64;
+    }
+    else if (strcmp(profile_str, "high-4:4:4") == 0) {
+        profile = 244;
+    }
+    else if (strcmp(profile_str, "multiview-high") == 0) {
+        profile = 118;
+    }
+    else if (strcmp(profile_str, "scalable-constrained-baseline") == 0) {
+        profile = 83;
+        constraint_set = 32;
+    }
+    else if (strcmp(profile_str, "scalable-baseline") == 0) {
+        profile = 83;
+    }
+    else if (strcmp(profile_str, "scalable-high") == 0) {
+        profile = 86;
+    }
+
+    level_str  = gst_structure_get_string (str, "level");
+    
+    if (strlen(level_str) == 1) {
+        level = atoi(level_str);
+    }    
+    else if (strcmp(level_str, "1b") == 0 && constraint_set == 64) {
+        level = 11;
+    }
+    else if (strcmp(level_str, "1b") == 0) {
+        level = 9;
+    }
+    else if (strcmp(level_str, "1.1") == 0) {
+        level = 11;
+    }
+    else if (strcmp(level_str, "1.2") == 0) {
+        level = 12;
+    }
+    else if (strcmp(level_str, "1.3") == 0) {
+        level = 13;
+    }
+    else if (strcmp(level_str, "2.1") == 0) {
+        level = 21;
+    }
+    else if (strcmp(level_str, "2.2") == 0) {
+        level = 22;
+    }
+    else if (strcmp(level_str, "3.1") == 0) {
+        level = 31;
+    }
+    else if (strcmp(level_str, "3.2") == 0) {
+        level = 32;
+    }
+    else if (strcmp(level_str, "4.1") == 0) {
+        level = 41;
+    }
+    else if (strcmp(level_str, "4.2") == 0) {
+        level = 42;
+    }
+    else if (strcmp(level_str, "5.1") == 0) {
+        level = 51;
+    }
+    else if (strcmp(level_str, "5.2") == 0) {
+        level = 52;
+    }
+    
+    GST_DEBUG ("profile: %s - %u constraint_set: %u level: %s - %u", profile_str, profile, constraint_set, level_str, level);
+
     type = STREAM_TYPE_VIDEO;
   }
 
@@ -170,6 +278,10 @@ gst_dash_manager_add_stream (GstStreamsManager * b_manager, GstPad * pad,
     bitrate = gst_discoverer_audio_info_get_bitrate (audio_info);
     caps = gst_discoverer_stream_info_get_caps (
         (GstDiscovererStreamInfo *) audio_info);
+    str = gst_caps_get_structure (caps, 0);
+    
+    profile_str = gst_structure_get_string (str, "profile");
+    
     type = STREAM_TYPE_AUDIO;
   }
 
@@ -185,8 +297,9 @@ gst_dash_manager_add_stream (GstStreamsManager * b_manager, GstPad * pad,
   pad_caps = gst_pad_get_current_caps (pad);
   mime_type = gst_structure_get_name (gst_caps_get_structure (pad_caps, 0));
   ret = gst_media_presentation_add_stream (manager->mpd, type,
-      pad_name, mime_type, width, height, par_n, par_d, framerate,
-      NULL, samplerate, bitrate, lang, b_manager->fragment_duration);
+      pad_name, mime_type, width, height, par_n, par_d,
+      framerate, profile, constraint_set, level, NULL,
+      samplerate, bitrate, lang, b_manager->fragment_duration);
   g_free (pad_name);
   gst_caps_unref (pad_caps);
   return ret;
diff --git a/ext/dash/mpd/gstmediacommon.c b/ext/dash/mpd/gstmediacommon.c
index 5007cf7..0505440 100644
--- a/ext/dash/mpd/gstmediacommon.c
+++ b/ext/dash/mpd/gstmediacommon.c
@@ -40,6 +40,7 @@ gst_media_common_init (GstMediaCommon * common)
   common->numberOfChannels = NULL;
   common->samplingRate = NULL;
   common->mimeType = NULL;
+  common->codec = NULL;
   common->group = 0;
   common->stream_type = STREAM_TYPE_UNKNOWN;
 }
@@ -59,6 +60,7 @@ gst_media_common_free (GstMediaCommon * common)
   g_list_free (common->samplingRate);
 
   g_free (common->mimeType);
+  g_free (common->codec);
 }
 
 gboolean
@@ -67,6 +69,9 @@ gst_media_common_render (GstMediaCommon * common, xmlTextWriterPtr writer)
   if (!gst_media_presentation_write_string_attribute (writer, "mimeType",
           common->mimeType))
     return FALSE;
+  if (!gst_media_presentation_write_string_attribute (writer, "codecs",
+          common->codec))
+    return FALSE;
   if (!gst_media_presentation_write_uint32_attribute (writer, "width",
           common->width))
     return FALSE;
diff --git a/ext/dash/mpd/gstmediacommon.h b/ext/dash/mpd/gstmediacommon.h
index 2830213..e3d64ae 100644
--- a/ext/dash/mpd/gstmediacommon.h
+++ b/ext/dash/mpd/gstmediacommon.h
@@ -52,6 +52,7 @@ struct _GstMediaCommon
   GList *numberOfChannels;
   GList *samplingRate;
   gchar *mimeType;
+  gchar *codec;
   guint32 group;
   gdouble maximumRAPPeriod;
   StreamType stream_type;
diff --git a/ext/dash/mpd/gstmediapresentation.c b/ext/dash/mpd/gstmediapresentation.c
index bb37bfb..ebc572d 100644
--- a/ext/dash/mpd/gstmediapresentation.c
+++ b/ext/dash/mpd/gstmediapresentation.c
@@ -35,6 +35,8 @@
 #define MIMETYPE_MP4 "mp4"
 #define MIMETYPE_MPEGTS "MP2T"
 #define MIMETYPE_MPEGTS_INFO "m2t"
+#define CODEC_TEMPLATE_VIDEO "avc1.%02x%02x%02x"
+#define CODEC_TEMPLATE_AUDIO "mp4a.%s"
 
 #define MPD_XML_INDENT 4
 
@@ -94,6 +96,9 @@ gst_media_presentation_clear (GstMediaPresentation * mpd)
     g_list_foreach (mpd->periods, (GFunc) gst_period_free, NULL);
 }
 
+// IHS TODO create similar version of below for codec
+// Move new constants to different header file, set codec template string here instead of in gstrepresentation.c
+
 static gchar *
 gst_media_presentation_format_mime_type (GstMediaPresentation * mpd,
     StreamType type, const gchar * mimeType)
@@ -118,6 +123,23 @@ gst_media_presentation_format_mime_type (GstMediaPresentation * mpd,
   }
 }
 
+static gchar *
+gst_media_presentation_format_codec (
+    GstMediaPresentation * mpd, StreamType type,
+    const gint profile, const gint constraint_set, const gint level)
+{
+  switch (type) {
+    case STREAM_TYPE_AUDIO:
+      // FIXME don't really hard-code this
+      return g_strdup_printf (CODEC_TEMPLATE_AUDIO, "40.2");
+    case STREAM_TYPE_VIDEO:
+      return g_strdup_printf (CODEC_TEMPLATE_VIDEO, profile, constraint_set, level);
+    default:
+      g_assert_not_reached ();
+      return NULL;
+  }
+}
+
 static void
 gst_media_presentation_add_profile (GstMediaPresentation * mpd,
     const gchar * mime_type)
@@ -150,13 +172,14 @@ gst_media_presentation_add_profile (GstMediaPresentation * mpd,
 gboolean
 gst_media_presentation_add_stream (GstMediaPresentation * mpd, StreamType type,
     gchar * id, const gchar * mimeType, guint32 width, guint32 height,
-    guint32 parx, guint32 pary, gdouble frameRate, gchar * channels,
-    guint32 samplingRate, guint32 bitrate, const gchar * lang,
-    guint fragment_duration)
+    guint32 parx, guint32 pary, gdouble frameRate, gint profile,
+    gint constraint_set, gint level, gchar * channels, guint32 samplingRate,
+    guint32 bitrate, const gchar * lang, guint fragment_duration)
 {
   GstPeriod *active_period;
   GstRepresentation *rep;
   gchar *mpd_mime_type;
+  gchar *mpd_codec;
 
   g_return_val_if_fail (mpd != NULL, FALSE);
 
@@ -164,6 +187,8 @@ gst_media_presentation_add_stream (GstMediaPresentation * mpd, StreamType type,
   if (mpd_mime_type == NULL)
     return FALSE;
 
+  mpd_codec = gst_media_presentation_format_codec (mpd, type, profile, constraint_set, level);
+
   gst_media_presentation_add_profile (mpd, mimeType);
 
   /* Get the current period or create a new one if it doesn't exists */
@@ -176,7 +201,7 @@ gst_media_presentation_add_stream (GstMediaPresentation * mpd, StreamType type,
 
   /* Add a new presentation to the active period */
   rep =
-      gst_representation_new (id, type, mpd_mime_type, width, height, parx,
+      gst_representation_new (id, type, mpd_mime_type, mpd_codec, width, height, parx,
       pary, frameRate, channels, samplingRate, bitrate, lang, mpd->use_ranges,
       fragment_duration);
   g_free (mpd_mime_type);
diff --git a/ext/dash/mpd/gstmediapresentation.h b/ext/dash/mpd/gstmediapresentation.h
index b32eb16..92834bb 100644
--- a/ext/dash/mpd/gstmediapresentation.h
+++ b/ext/dash/mpd/gstmediapresentation.h
@@ -66,6 +66,7 @@ gboolean gst_media_presentation_add_stream            (GstMediaPresentation *mpd
                                                        const gchar *mimeType, guint32 width,
                                                        guint32 height, guint32 parx,
                                                        guint32 pary, gdouble frameRate,
+                                                       gint profile, gint compat, gint level,
                                                        gchar* channels, guint32 samplingRate,
                                                        guint32 bitrate, const gchar *lang,
                                                        guint fragment_duration);
diff --git a/ext/dash/mpd/gstrepresentation.c b/ext/dash/mpd/gstrepresentation.c
index 4b433f4..fe8414f 100644
--- a/ext/dash/mpd/gstrepresentation.c
+++ b/ext/dash/mpd/gstrepresentation.c
@@ -26,10 +26,10 @@
 
 GstRepresentation *
 gst_representation_new (gchar * id, StreamType stream_type,
-    const gchar * mimeType, guint32 width,
+    const gchar * mimeType, const gchar * codec, guint32 width,
     guint32 height, guint32 parx, guint32 pary, gdouble frameRate,
-    gchar * channels, guint32 samplingRate, guint32 bitrate, const gchar * lang,
-    gboolean use_ranges, guint fragment_duration)
+    gchar * channels, guint32 samplingRate, guint32 bitrate,
+    const gchar * lang, gboolean use_ranges, guint fragment_duration)
 {
   GstRepresentation *rep;
   GList *langs = NULL;
@@ -40,6 +40,7 @@ gst_representation_new (gchar * id, StreamType stream_type,
   rep->common.stream_type = stream_type;
   g_free (rep->common.mimeType);
   rep->common.mimeType = g_strdup (mimeType);
+  rep->common.codec = g_strdup (codec);
   rep->common.width = width;
   rep->common.height = height;
   rep->common.parx = parx;
diff --git a/ext/dash/mpd/gstrepresentation.h b/ext/dash/mpd/gstrepresentation.h
index 760967c..7ec0743 100644
--- a/ext/dash/mpd/gstrepresentation.h
+++ b/ext/dash/mpd/gstrepresentation.h
@@ -42,8 +42,10 @@ struct _GstRepresentation
 
 
 GstRepresentation * gst_representation_new  (gchar *id, StreamType stream_type,
-                                             const gchar *mimeType, guint32 width,
-                                             guint32 height, guint32 parx, guint32 pary,
+                                             const gchar *mimeType,
+                                             const gchar * codec,
+                                             guint32 width, guint32 height, 
+                                             guint32 parx, guint32 pary,
                                              gdouble frameRate, gchar* channels,
                                              guint32 samplingRate, guint32 bitrate,
                                              const gchar  *lang, gboolean use_rangesm,
