I am trying to encode data into an mp4 file.
So for instance, if I have the numbers 148, 102, 88, I might create an RGB pixels with those values.
Once I decode the frame from the mp4, I would like to read the pixels and get back those exact same values.
I thought that if I compress mp4 with lossless, then it will be possible, but it seems to always give me inaccurate values.
I see that on the MSbits it's somewhat accurate, but maybe the 2 or 3 MSb, not sure.
When I tried to use 4MSb it wasn't accurate as well.
Is there a way to encode bits into an MP4/H264 and be able to get an exact read of them?
I am reading the mp4 using DOM Video Element, and into a THREE.Texture.
Perhaps something there it's breaking.
If I create a THREE.DataTexture from a png, that is one of the frames used to create the mp4, then I do get the exact values I expect.
I don't think I am filtering the texture or something similar.
This mean that if I pass a texture from a png through the entire pipeline of my code, then it works well, but if pass a texture from an mp4, that was suppose to be lossless, it doesn't.
I think that maybe even a lossless mp4 doesn't show colors accurately, because it use YUV representation?