[FFmpeg-devel] [PATCH] avformat/riffenc: indicate storage of flipped RGB bitmaps

Gyan Doshi ffmpeg at gyani.pro
Tue Jul 14 15:16:03 EEST 2020



On 14-07-2020 05:14 pm, Andreas Rheinhardt wrote:
> Gyan Doshi:
>> Some legacy applications such as AVI2MVE expect raw RGB bitmaps
>> to be stored bottom-up, whereas our RIFF BITMAPINFOHEADER assumes
>> they are always stored top-down and thus write a negative value
>> for height. This can prevent reading of these files.
>>
>> Option flipped_raw_rgb added to AVI and Matroska muxers
>> which will write positive value for height when enabled.
>>
>> Note that the user has to flip the bitmaps beforehand using other
>> means such as the vflip filter.
>> ---
> 1. The avi demuxer adds "BottomUp" to the extradata in case it demuxes
> bottom up data. The Matroska demuxer currently doesn't and so rawvideo
> stored in Matroska in vfw mode will always be treated as top-down. This
> needs to be fixed, too.

Agreed. But that's a separate patch,

> 2. But why don't we add an option to the raw encoder so that it adds (or
> maybe switches?) "BottomUp" to the extradata to indicate that the output
> is bottom-up? That seems like a better place for me. (E.g. it would
> naturally allow to set the bottom-up/top-down property on a per-stream
> basis.)

This "feature" is a quirk of Microsoft / RIFF containers (or their 
accommodation in other containers viz. VFW in Matroska) rather than a 
generic property of raw video streams - the extradata string is an 
ffmpeg invention. Since this option is meant to pacify old legacy apps 
which wouldn't deal with multiple streams, per-stream assignment is a 
bonus but not necessary. I modified Matroska muxer for completeness 
rather than expecting anyone to actually use it.

Gyan


More information about the ffmpeg-devel mailing list