sipsorcery-org / SIPSorceryMedia.FFmpeg

GNU Lesser General Public License v2.1
34 stars 26 forks source link

AV_PIX_FMT_RGB24 or AV_PIX_FMT_BGR24 #29

Closed TonyZhu2015 closed 2 years ago

TonyZhu2015 commented 2 years ago

Hi Team,

I am learning the source code of FFmpegVideoEncoder. On line 444. for _i420ToRgb converter, the target PixelFormat is AV_PIXFMTBGR24 instead of AV_PIX_FMT_RGB24. This baffles me if I correct this by changing it to AV_PIX_FMT_RGB24 to be consistent. The video is blue washed(showing blue). Can you help me understand this?

_i420ToRgb = new VideoFrameConverter( width, height, AVPixelFormat.AV_PIX_FMT_YUV420P, width, height, AVPixelFormat.AV_PIX_FMT_BGR24);

Appreciate it,

Regards, Rong Zhu

ChristopheI commented 2 years ago

Hi @TonyZhu2015 ,

It's because in FFmpeg library AV_PIX_FMT_BGR24 format is equivalent to PixelFormat.Format24bppRgb format used to manage Bitmap

For example

Bitmap bmpImage = new Bitmap(width, height, stride, PixelFormat.Format24bppRgb, sample);
TonyZhu2015 commented 2 years ago

Thanks very much. I will close this issue