diff --git a/configure b/configure
index 8fc71fb..9587184 100755
--- a/configure
+++ b/configure
@@ -2662,10 +2662,14 @@ vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
 vp8_cuvid_hwaccel_deps="cuda cuvid"
 vp9_cuvid_hwaccel_deps="cuda cuvid"
+vp8_mediacodec_decoder_deps="mediacodec"
+vp8_mediacodec_hwaccel_deps="mediacodec"
 vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
 vp9_dxva2_hwaccel_select="vp9_decoder"
+vp9_mediacodec_decoder_deps="mediacodec"
+vp9_mediacodec_hwaccel_deps="mediacodec"
 vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9"
 vp9_vaapi_hwaccel_select="vp9_decoder"
 wmv3_crystalhd_decoder_select="crystalhd"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a1560ba..734c79d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -595,9 +595,11 @@ OBJS-$(CONFIG_VP6_DECODER)             += vp6.o vp56.o vp56data.o \
 OBJS-$(CONFIG_VP7_DECODER)             += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_CUVID_DECODER)       += cuvid.o
+OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
 OBJS-$(CONFIG_VP9_DECODER)             += vp9.o vp9dsp.o vp56rac.o vp9dsp_8bpp.o \
                                           vp9dsp_10bpp.o vp9dsp_12bpp.o
 OBJS-$(CONFIG_VP9_CUVID_DECODER)       += cuvid.o
+OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)  += mediacodecdec_h2645.o
 OBJS-$(CONFIG_VPLAYER_DECODER)         += textdec.o ass.o
 OBJS-$(CONFIG_VQA_DECODER)             += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER)         += wavpack.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index fed740a..44f7205 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -115,9 +115,11 @@ void avcodec_register_all(void)
     REGISTER_HWACCEL(VC1_MMAL,          vc1_mmal);
     REGISTER_HWACCEL(VC1_QSV,           vc1_qsv);
     REGISTER_HWACCEL(VP8_CUVID,         vp8_cuvid);
+    REGISTER_HWACCEL(VP8_MEDIACODEC,    vp8_mediacodec);
     REGISTER_HWACCEL(VP9_CUVID,         vp9_cuvid);
     REGISTER_HWACCEL(VP9_D3D11VA,       vp9_d3d11va);
     REGISTER_HWACCEL(VP9_DXVA2,         vp9_dxva2);
+    REGISTER_HWACCEL(VP9_MEDIACODEC,    vp9_mediacodec);
     REGISTER_HWACCEL(VP9_VAAPI,         vp9_vaapi);
     REGISTER_HWACCEL(WMV3_D3D11VA,      wmv3_d3d11va);
     REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
@@ -657,7 +659,9 @@ void avcodec_register_all(void)
     REGISTER_DECODER(MPEG4_CUVID,       mpeg4_cuvid);
     REGISTER_DECODER(VC1_CUVID,         vc1_cuvid);
     REGISTER_DECODER(VP8_CUVID,         vp8_cuvid);
+    REGISTER_DECODER(VP8_MEDIACODEC,    vp8_mediacodec);
     REGISTER_DECODER(VP9_CUVID,         vp9_cuvid);
+    REGISTER_DECODER(VP9_MEDIACODEC,    vp9_mediacodec);
 
     /* parsers */
     REGISTER_PARSER(AAC,                aac);
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 8ff1138..e5a8dbc 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -766,3 +766,17 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = {
     .id      = AV_CODEC_ID_HEVC,
     .pix_fmt = AV_PIX_FMT_MEDIACODEC,
 };
+
+AVHWAccel ff_vp8_mediacodec_hwaccel = {
+    .name    = "mediacodec",
+    .type    = AVMEDIA_TYPE_VIDEO,
+    .id      = AV_CODEC_ID_VP8,
+    .pix_fmt = AV_PIX_FMT_MEDIACODEC,
+};
+
+AVHWAccel ff_vp9_mediacodec_hwaccel = {
+    .name    = "mediacodec",
+    .type    = AVMEDIA_TYPE_VIDEO,
+    .id      = AV_CODEC_ID_VP9,
+    .pix_fmt = AV_PIX_FMT_MEDIACODEC,
+};
diff --git a/libavcodec/mediacodecdec_h2645.c b/libavcodec/mediacodecdec_h2645.c
index d5a35a1..c5f5af2 100644
--- a/libavcodec/mediacodecdec_h2645.c
+++ b/libavcodec/mediacodecdec_h2645.c
@@ -1,5 +1,5 @@
 /*
- * Android MediaCodec H.264 / H.265 decoders
+ * Android MediaCodec H.264 / H.265 / VP8 / VP9 decoders
  *
  * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
  *
@@ -65,6 +65,7 @@ static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
+#if CONFIG_H264_MEDIACODEC_DECODER || CONFIG_HEVC_MEDIACODEC_DECODER
 static int h2645_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int *out_size)
 {
     int i;
@@ -116,6 +117,7 @@ done:
 
     return ret;
 }
+#endif
 
 #if CONFIG_H264_MEDIACODEC_DECODER
 static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
@@ -264,6 +266,19 @@ done:
 }
 #endif
 
+#if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER
+static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
+{
+    int ret = 0;
+
+    if (avctx->extradata) {
+        ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size);
+    }
+
+    return ret;
+}
+#endif
+
 static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
 {
     int ret;
@@ -304,6 +319,24 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
             goto done;
         break;
 #endif
+#if CONFIG_VP8_MEDIACODEC_DECODER
+    case AV_CODEC_ID_VP8:
+        codec_mime = "video/x-vnd.on2.vp8";
+
+        ret = vpx_set_extradata(avctx, format);
+        if (ret < 0)
+            goto done;
+        break;
+#endif
+#if CONFIG_VP9_MEDIACODEC_DECODER
+    case AV_CODEC_ID_VP9:
+        codec_mime = "video/x-vnd.on2.vp9";
+
+        ret = vpx_set_extradata(avctx, format);
+        if (ret < 0)
+            goto done;
+        break;
+#endif
     default:
         av_assert0(0);
     }
@@ -332,6 +365,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
         goto done;
     }
 
+    if (bsf_name) {
     bsf = av_bsf_get_by_name(bsf_name);
     if(!bsf) {
         ret = AVERROR_BSF_NOT_FOUND;
@@ -346,6 +380,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
         ((ret = av_bsf_init(s->bsf)) < 0)) {
           goto done;
     }
+    }
 
     av_init_packet(&s->filtered_pkt);
 
@@ -436,6 +471,7 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data,
 
             av_fifo_generic_read(s->fifo, &input_pkt, sizeof(input_pkt), NULL);
 
+            if (s->bsf) {
             ret = av_bsf_send_packet(s->bsf, &input_pkt);
             if (ret < 0) {
                 return ret;
@@ -445,6 +481,9 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data,
             if (ret == AVERROR(EAGAIN)) {
                 goto done;
             }
+            } else {
+                av_packet_move_ref(&s->filtered_pkt, &input_pkt);
+            }
 
             /* {h264,hevc}_mp4toannexb are used here and do not require flushing */
             av_assert0(ret != AVERROR_EOF);
@@ -512,3 +551,35 @@ AVCodec ff_hevc_mediacodec_decoder = {
     .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
 };
 #endif
+
+#if CONFIG_VP8_MEDIACODEC_DECODER
+AVCodec ff_vp8_mediacodec_decoder = {
+    .name           = "vp8_mediacodec",
+    .long_name      = NULL_IF_CONFIG_SMALL("VP8 Android MediaCodec decoder"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_VP8,
+    .priv_data_size = sizeof(MediaCodecH264DecContext),
+    .init           = mediacodec_decode_init,
+    .decode         = mediacodec_decode_frame,
+    .flush          = mediacodec_decode_flush,
+    .close          = mediacodec_decode_close,
+    .capabilities   = CODEC_CAP_DELAY,
+    .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
+};
+#endif
+
+#if CONFIG_VP9_MEDIACODEC_DECODER
+AVCodec ff_vp9_mediacodec_decoder = {
+    .name           = "vp9_mediacodec",
+    .long_name      = NULL_IF_CONFIG_SMALL("VP9 Android MediaCodec decoder"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_VP9,
+    .priv_data_size = sizeof(MediaCodecH264DecContext),
+    .init           = mediacodec_decode_init,
+    .decode         = mediacodec_decode_frame,
+    .flush          = mediacodec_decode_flush,
+    .close          = mediacodec_decode_close,
+    .capabilities   = CODEC_CAP_DELAY,
+    .caps_internal  = FF_CODEC_CAP_SETS_PKT_DTS,
+};
+#endif
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4e34850..00c3d58 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  61
+#define LIBAVCODEC_VERSION_MINOR  62
 #define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
