canvas-capture icon indicating copy to clipboard operation
canvas-capture copied to clipboard

mp4 export – color desaturation

Open amandaghassaei opened this issue 3 years ago • 0 comments

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: frame_1

Webm export visually looks quite similar: webmoutput

MP4 export is desaturated: mp4output_defaultSettings 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: mp4output

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: frame_1

MP4 directly from ground truth: mp4output_fromFrames

settings:

{
  '-c:v': 'libx264',
  '-preset': 'slow',
  '-crf': '22',
  '-pix_fmt': 'yuv420p',
  '-an',
}

amandaghassaei avatar Feb 23 '22 01:02 amandaghassaei