[FFmpeg-devel] [PATCH]Force 16bpp when writing RGB 5:5:5 rawvideo to avi
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Apr 13 18:53:07 CEST 2014
Hi!
WMP expects RGB 5:5:5 rawvideo in avi to have bits_per_pixel set to 16, this
is also explained on http://www.fourcc.org/rgb.php
ffmpeg -i input -vcodec rawvideo -pix_fmt rgb555le out.avi produces files that
WMP cannot read because bpp is set to 15, not a regression afaict.
Attached patch forces bpp to 16 for RGB555LE, this does not affect decoding
with FFmpeg since we interpret both 15 and 16bpp as RGB555LE.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 5acc7c2..7d5aee0 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -308,6 +308,12 @@ static int avi_write_header(AVFormatContext *s)
if (stream->codec_id != AV_CODEC_ID_XSUB)
break;
case AVMEDIA_TYPE_VIDEO:
+ /* WMP expects RGB 5:5:5 rawvideo in avi to have bpp set to 16. */
+ if ( !stream->codec_tag
+ && stream->codec_id == AV_CODEC_ID_RAWVIDEO
+ && stream->pix_fmt == AV_PIX_FMT_RGB555LE
+ && stream->bits_per_coded_sample == 15)
+ stream->bits_per_coded_sample = 16;
ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0, 0);
pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
stream->bits_per_coded_sample);
More information about the ffmpeg-devel
mailing list