radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
352 stars 56 forks source link

Problem in Stride Calculation #68

Closed shakirbsm closed 3 years ago

shakirbsm commented 3 years ago

I found this project helpful and interesting, however while encoding videos from images i have found a problem that my animation was somehow translated in such a way that it seems to be a parallelogram with upper left somewhere in middle. After some debugging i found out that it might be problem with stride calculation. I have images with following details: Width: 1890 Pixels Height: 1512 Pixels PixelFormat: 24bppRgb Stride from ImageData = 5670 whereas from my calculation of stride it should be 5672 I have calculated stride with following formula as given in msdn forums Stride = 4 (Bitmap.Width BitsPerPixel + 31)/32)

radek-k commented 3 years ago

I've just fixed it in the v4.0.1 release.

shakirbsm commented 3 years ago

This is great. Now it works perfectly. Thanks for such a quick response and fix.