[FFmpeg-devel] [PATCH 1/3] lavf/riffenc: Improve spec compliance
Mats Peterson
matsp888 at yahoo.com
Fri Mar 11 13:41:43 CET 2016
On 03/11/2016 01:28 PM, Mats Peterson wrote:
> On 03/11/2016 01:25 PM, Mats Peterson wrote:
>> On 03/11/2016 01:14 PM, Michael Niedermayer wrote:
>>> On Fri, Mar 11, 2016 at 05:17:18AM +0100, 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
>>>>> https://msdn.microsoft.com/en-us/library/windows/desktop/dd318229%28v=vs.85%29.aspx:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "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.
>>>>>
>>>>> Mats
>>>>>
>>>>>
>>>>>
>>>>
>>>> Once, again, HuffYUV has its own variant of BITMAPINFOHEADER that
>>>> *does* include the size of the Huffman tables in biSize. That's the
>>>> only exception as far as I know.
>>>
>>> is huffyuv really the exception ? and not raw rgb or palettes ?
>>>
>>> asv1 and asv2 do not have 40 there
>>> which codec with a non-palette global header puts 40 there ?
>>>
>>> [...]
>>
>> biSize should only be the size of the very BITMAPINFOHEADER, not
>> including the palette or extra data. HuffYUV has its own
>> BITMAPINFOHEADER, once again.
>>
>> Mats
>>
>
> As I said before, Microsoft Video 1 in 8-bit mode and RLE4/RLE8 won't
> even display in Windows Media Player if this value is anything else than
> 40.
>
> Mats
>
For the record, I submitted a patch for MKVToolnix regarding this issue
in the past. It incorrectly included the palette size in biSize as well.
Mats
More information about the ffmpeg-devel
mailing list