chaiNNer-org / chaiNNer

A node-based image processing GUI aimed at making chaining image processing tasks easy and customizable. Born as an AI upscaling application, chaiNNer has grown into an extremely flexible and powerful programmatic image processing application.
https://chaiNNer.app
GNU General Public License v3.0
4.7k stars 286 forks source link

Save Video Produces Inaccurate Colors #3053

Open KiyoshiKuro opened 1 week ago

KiyoshiKuro commented 1 week ago

Description

Colors in videos saved from Chainner are inaccurate, regardless of whether an upscale model is used or not. The issue persists across different formats and encoders. However, if I save the output as images instead of a video, the colors are correct.

I've tried a clean install of Chainner and extracting PNGs of the video frames before saving them as a video, but the colors remain incorrect. This happens with any video I've tested.

In previous versions of Chainner, when it used the Video Frame Iterator, I was able to upscale videos without color issues.

chaiNNer - R__Chainner Chains_Video chn • video mkv - mpv video2 mkv - mpv

In the example, the greens are darker, and the reds are desaturated.

Logs main.log

pokepress commented 2 days ago

This is purely a hunch, but is is it possible it's an issue with FFMPEG, or the version being used by the software?

KiyoshiKuro commented 1 day ago

Using my own ffmpeg with the command "ffmpeg -i input.mkv -c:v ffv1 output.mkv" produces a video with accurate colors. My own encode is also almost double the size of chainner's. I tried replacing chainner's ffmpeg.exe and ffprobe.exe with the mine, and chainner still produces inaccurate colors. I've attached mediainfo for mine and chainner's encodes. chainnerffmpeg.txt myffmpeg.txt

NSQY commented 1 day ago

This is caused by a color matrix mismatch when converting to or from RGB. It is often merely a metadata error.

KiyoshiKuro commented 1 day ago

Thanks for your response. I'm not entirely sure what to do with that info. I tried editing the save video parameters to include "-colorspace bt709 -color_primaries bt709 -color_trc bt709" and it produced the same inaccurate colors as before, but the mediainfo does look closer to my own encode... chainnerffmpeg2.txt