View Full Version : Change yuv individual pixel colour
coolgit
24th January 2023, 21:25
Is there a function/plugin that can change pixel with luma 17 to 16.
I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.
When i checked with ColorYUV(analyze=true), both original and new file, it didn't work. Apparently it changed another colour but i don't know which.
tara
Reel.Deel
24th January 2023, 21:42
This mt_lut("x 17 == 16 x ?", u=2, v=2) or Expr("x 17 == 16 x ?", "") will change luma pixels with a value of 17 to 16. Chroma is copied.
wonkey_monkey
25th January 2023, 00:37
I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.
The data in an .mp4 is compressed and won't bear any direct relation to pixel values. Changing bytes directly like that is likely to corrupt the file.
coolgit
25th January 2023, 00:45
This mt_lut("x 17 == 16 x ?", u=2, v=2) or Expr("x 17 == 16 x ?", "") will change luma pixels with a value of 17 to 16. Chroma is copied.
Wow :thanks: for that. I will try both to see which is faster.
coolgit
25th January 2023, 00:49
The data in an .mp4 is compressed and won't bear any direct relation to pixel values. Changing bytes directly like that is likely to corrupt the file.
Well i luckily didn't get a corrupt file but one pixel colour did change to another but no idea which. It's a pity as Hex editor was super super fast.
Reel.Deel
25th January 2023, 04:07
Wow :thanks: for that. I will try both to see which is faster.
From my experience, on 8-bit, mt_lut is almost always faster than expr.
coolgit
25th January 2023, 13:37
From my experience, on 8-bit, mt_lut is almost always faster than expr.
40 minutes video... expr 7 seconds faster. Not enough difference to fuss about really.
Reel.Deel
25th January 2023, 18:11
40 minutes video... expr 7 seconds faster. Not enough difference to fuss about really.
Interesting. With ColorBarsHD() as the source, I get 850fps with Expr and 1200 with mt_lut. I don't have an AVX2 capable processor. But yes, it does not make a difference once the encoder gets involved :)
wonkey_monkey
25th January 2023, 18:39
I find mt_lut to be 30% quicker single-threaded, but expr is 30% quicker using prefetch.
Reel.Deel
25th January 2023, 19:13
Using Prefetch(4) I get 2840fps with mt_lut and 2680 with Expr. With Prefetch(6), Expr is slightly faster (3480 vs 3450) and both about 50% cpu usage.
StainlessS
25th January 2023, 19:59
RD,
hows bout with
ColorBarsHD()
Loop() # play the clip (almost) endlessly.
Prefetch(4) # or not
(not sure if that speeds it up or not)
I aint got Avisynth installed at the moment.
Reel.Deel
25th January 2023, 20:06
RD,
hows bout with
ColorBarsHD()
Loop() # play the clip (almost) endlessly.
Prefetch(4) # or not
(not sure if that speeds it up or not)
I aint got Avisynth installed at the moment.
I get 381839fps with that script. In AviSynth+ the ColorBar filters have a "staticframes" parameter, true by default so it only generates one frame and the rest are copied.
StainlessS
25th January 2023, 20:08
OOps, I forgot to insert the the mt_lut() and Expr() bits.
Reel.Deel
25th January 2023, 20:13
OOps, I forgot to insert the the mt_lut() and Expr() bits.
I used Loop when testing with Prefetch in post #10, only because without it, it finishes too fast.
StainlessS
25th January 2023, 20:19
Makes sense.
I'm off to bed, 19:45 and I did not get to bed last night ZZZZzzzzz.....
kedautinh12
26th January 2023, 00:48
Yeah, you need sleep to charge, Staindroid :D
StainlessS
26th January 2023, 12:10
Sleep is for wimps.
(I somtimes have to wimp out - or pass out)
kolak
26th January 2023, 12:50
Is there a function/plugin that can change pixel with luma 17 to 16.
I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.
When i checked with ColorYUV(analyze=true), both original and new file, it didn't work. Apparently it changed another colour but i don't know which.
tara
Are you trying to make file legal ?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.