[FFmpeg-devel] [PATCH 1/3] lavf/riffenc: Improve spec compliance
matsp888 at yahoo.com
Fri Mar 11 18:08:36 CET 2016
On 03/11/2016 06:06 PM, Mats Peterson wrote:
> On 03/11/2016 06:04 PM, Mats Peterson wrote:
>> On 03/11/2016 05:10 AM, Mats Peterson wrote:
>>> Forget patch 2/3 and 3/3 from the old patch set.
>>> From the Microsoft documentation for BITMAPINFOHEADER at
>>> "biSize: Specifies the number of bytes required by the structure. This
>>> value does not include the size of the color table or the size of the
>>> color masks, if they are appended to the end of structure."
>>> So, biSize is always 40. Also, Windows Media Player won't detect video
>>> encoded with Microsoft Video 1 in 8 bpp mode if this value is anything
>>> else than 40. I don't know about other codecs, they probably work.
>>> Anyway, we should stick with the specs, and not include the palette size
>>> in that field.
>>> Regarding the biClrUsed field, I'm setting it to 1 <<
>>> bits_per_coded_sample if palettized video, since setting it to 0 is
>>> another case where it won't work with Windows Media Player and Microsoft
>>> Video 1 in 8 bpp mode.
>> Regarding HuffYUV, I would say it breaks the specs by using its own
>> BITMAPINFOHEADER larger than 40 bytes, but we can't do much about that
>> now. For other codecs, anything after the BITMAPINFOHEADER, be it a
>> palette or other data, should NOT be included in biSize, since that's
>> what Microsoft tells us. They don't mention non-palette data, but that's
>> almost implicit.
>> Remember, biSize is "The number of bytes required by the structure." I'm
>> quoting Microsoft. The structure is the BITMAPINFOHEADER, nothing else.
> To get the size of any "global non-palette header" or whatever, just
> subtract the size of the BITMAPINFOHEADER (40 bytes) from the size of
> the strf chunk.
Both HuffYUV, ffvhuff and asv1/asv2 work just fine on demuxing when
using a biSize of 40, for the record.
More information about the ffmpeg-devel