GNOME Bugzilla – Bug 715137
avimux: padding granularity field not filled in correctly
Last modified: 2013-11-25 13:03:50 UTC
Avimux never actually fills the padding granularity field of the AVI header. This is important when working with non-default image sizes, since GStreamer requires each row to be padded to the next 4-byte boundary. Leaving this field zero results in ffmpeg and vlc interpreting the padding as actual image data, wrapping it onto the next row. This introduces an incremental spatial shift with each new row. The variable avimux->avi_hdr.pad_gran is there, yet it is never assigned a value. This could default to 4. I assume there may be some corner cases where 4 is incorrect, but non that I can think of right now.
GStreamer defaults to 4 byte aligned strides, but in 1.x this can be any value really if the element supports the GstVideoMeta (avimux does not).
Note that this header is per file, not per stream. So not really usable for this problem here.
Microsoft's standard for the bitmap (BMP) format defines that rows of pixels in a bitmap file must be padded to an integer multiple of 4 bytes: http://msdn.microsoft.com/en-us/library/windows/desktop/dd318229(v=vs.85).aspx So, GStreamer is one of the only tools implementing this correctly. Please close this.