Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 | Link |
Chiptuner & VapourSynther
Join Date: Mar 2019
Location: Scarlet Devil Mansion, Gensōkyō
Posts: 52
|
FFMS2 changing RGB values when importing palette-indexed BMP/PNG files
I don’t know if this is a bug in VapourSynth R63 or in FFMS2 3.0.1.0 1325+16 6ad7738, but basically when importing (via core.ffms2.Source) indexed BMP or PNG images (that is, images whose pixels don’t store RGB color values but rather indices to a color palette stored in the files’ metadata), some of their pixels’ RGB color values get changed to slightly-different values, even when they’re imported in RGB24 mode (rather than a YUV or YCbCr mode). (This problem does not happen at all with regular RGB24 BMP/PNG files where RGB values are stored directly in the pixels themselves instead of in a palette.)
Attached to this thread is a ZIP with two visually-identical 16×16-pixel BMP files where each pixel is a different shade of gray (out of the 256 values allowed in GRAY8). Y8_index.bmp is the indexed or palettized version (8-bit grayscale palette, 256 indices), while Y8_rgb.bmp is the RGB24-mode version. This is the VPY script I am running to test VapourSynth & FFMS2’s behavior when handling indexed images vs. RGB24 images: Code:
import vapoursynth as vs from vapoursynth import core Y8_index = core.ffms2.Source(r'Y8_index.bmp',fpsnum=60,fpsden=1) Y8_rgb = core.ffms2.Source(r'Y8_rgb.bmp',fpsnum=60,fpsden=1) FinalVideo = Y8_index*60+Y8_rgb*60 FinalVideo.set_output()
__________________
SilSinn9801 a.k.a. Silent Sinner in Scarlet Discord: silsinn9801 Matrix: silsinn9821:matrix.org YouTube: https://youtube.com/SilentSinnerInScarlet ニコニコ動画: https://nicovideo.jp/user/68029427 |
![]() |
![]() |
Tags |
ffms2, indexed palette, rgb24, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|