A solution to fix mp4 color differences between browsers

Hello all,

I came across the issue of mp4 videos having different colors between browsers: in Chrome, it was matching my background color, but not on Safari. I found a solution that worked for me so I thought I’d share.

The problem comes from mp4 color profiles and how browsers deal with them. The idea is to change the color profile of your mp4 files, but I did not find a direct way to do it. What I did was:

  1. Converting my mp4 file to webm. This time I noticed that colors were the same on all browsers but I needed an mp4 file. For the conversion, I used one of the top google results for “mp4 to web”, I guess they all work pretty well.

  2. Using ffmpeg, converting it the webm back to mp4 with the following command:

ffmpeg -i input.webm -color_primaries 5 -colorspace 5 output.mp4

It will seem obvious for most of you but for rookies like me, you first need to download ffmpeg (homebrew can help you with that). Then when you write the above code, you need to replace input.webm by your video and its path. So you type "ffmpeg -i ", then drag your video in the terminal and paste the reste of the code.