diff --git a/libavformat/mov.c b/libavformat/mov.c index 95dc1ee7ad91094f480878f869f4ab55a86945f2..9532213023d3b71b3389992dc331d81bc752656a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -200,6 +200,14 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) if (ret < 0) return ret; + if (pkt.size >= 8 && id != AV_CODEC_ID_BMP) { + if (AV_RB64(pkt.data) == 0x89504e470d0a1a0a) { + id = AV_CODEC_ID_PNG; + } else { + id = AV_CODEC_ID_MJPEG; + } + } + st->disposition |= AV_DISPOSITION_ATTACHED_PIC; st->attached_pic = pkt;