canvas-capture
canvas-capture copied to clipboard
mp4 export – color desaturation
I've noticed a slight color desaturation via mp4 export and I'm trying to figure out if it is possible to improve this.
Ground truth:
Webm export visually looks quite similar:
MP4 export is desaturated:
using default settings:
{
'-c:v': 'libx264',
'-preset': 'slow',
'-crf': '22',
'-pix_fmt': 'yuv420p',
'-vf', 'crop=trunc(iw/2)*2:trunc(ih/2)*2',
'-an',
}
I've tried adding additional settings:
ffmpegOptions: {
// Options to help prevent color desaturation.
// https://medium.com/invideo-io/talking-about-colorspaces-and-ffmpeg-f6d0b037cc2f
// BT.709 Colour Space
'-vf': 'colorspace=all=bt709',
// '-pix_fmt': 'yuvj420p',
'-colorspace': 'bt709',
'-color_primaries': 'bt709',
'-color_trc': 'bt709',
'-color_range': 'pc',
},
This has little effect:
This is likely related to Issue https://github.com/amandaghassaei/canvas-capture/issues/4 , and while I think this will help, I'm not convinced that this will solve the entire problem. Here is what processing the mp4 straight from the ground truth image looks like.
Ground truth:
MP4 directly from ground truth:
settings:
{
'-c:v': 'libx264',
'-preset': 'slow',
'-crf': '22',
'-pix_fmt': 'yuv420p',
'-an',
}