[FFmpeg-devel] [PATCH]Set the rawvideo image size to 0 in the bitmapinfoheader

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Sep 29 01:30:44 CEST 2014


Hi!

Attached patch fixes ticket #1304: biSizeImage may be 0 for images with codec 
tag 0, if the size is set too small, WMP refuses to play the file.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 2eb2ae1..9e30f64 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -224,7 +224,11 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
     avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24);
     /* compression type */
     avio_wl32(pb, enc->codec_tag);
+    if (!enc->codec_tag) {
+        avio_wl32(pb, 0);
+    } else {
     avio_wl32(pb, (enc->width * enc->height * (enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24)+7) / 8);
+    }
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);


More information about the ffmpeg-devel mailing list