Page 1 of 1

Converting 16 bit SGI to 8 bit RGB

Posted: Wed Apr 24, 2019 9:52 pm
by mikeiz
I'm converting 2160p SGI files that I got from vqeg.its.blddoc.gov into an RGB24 AVI video sequence using the following command:

Code: Select all

ffmpeg -start_number 07111 -r 50 -vsync 0 -i %%5d.sgi -vcodec rawvideo -pix_fmt rgb24 -r 50 -y D:\SVT_CrowdRun_3840x2160p_60_8b_RGB_500.avi
The AVI file looks good when I play it with mpv, but I'm curious as to how FFMPEG makes the 16 bits per color channel or 48 bits per pixel to 8 bits per color channel or 24 bits per pixel.

Re: Converting 16 bit SGI to 8 bit RGB

Posted: Sat Apr 27, 2019 9:28 am
by pandy
Check ffmpeg sources - i assume ffmpeg perform requantization and to reduce quantization errors you may apply some form of dithering. Also you may wish to apply some LUT to achieve non-linear processing.

Re: Converting 16 bit SGI to 8 bit RGB

Posted: Tue Apr 30, 2019 3:13 pm
by mikeiz
What is ffmpeg doing to convert 16 bits per color sgi to 8 bits per color RGB. That's what I want to know. Is it just doing a divide by 256; shift right by 8?

Re: Converting 16 bit SGI to 8 bit RGB

Posted: Tue May 07, 2019 9:01 pm
by pandy
Once again - i highly recommend to ffmpeg source inspection - AFAIK libswscale is responsible for this. You will see by yourself what's going on with conversion from 16 to 8 bit.